From 3340183421dbaad7cacbc38c44f6d880e1852b28 Mon Sep 17 00:00:00 2001 From: Jiahui Peng <46921893+Alancere@users.noreply.github.com> Date: Tue, 12 Apr 2022 20:16:38 +0800 Subject: [PATCH] Release refresh all package R10 (#17543) * [Release] sdk/resourcemanager/machinelearningservices/armmachinelearningservices/0.3.0 generation from spec commit: 845321c7088aa9b1aa2d715b87aa0d052e2ca976 * [Release] sdk/resourcemanager/maintenance/armmaintenance/0.3.0 generation from spec commit: 845321c7088aa9b1aa2d715b87aa0d052e2ca976 * [Release] sdk/resourcemanager/managedservices/armmanagedservices/0.3.0 generation from spec commit: 845321c7088aa9b1aa2d715b87aa0d052e2ca976 * [Release] sdk/resourcemanager/managementgroups/armmanagementgroups/0.5.0 generation from spec commit: 845321c7088aa9b1aa2d715b87aa0d052e2ca976 * [Release] sdk/resourcemanager/managementpartner/armmanagementpartner/0.3.0 generation from spec commit: 845321c7088aa9b1aa2d715b87aa0d052e2ca976 * [Release] sdk/resourcemanager/maps/armmaps/0.3.0 generation from spec commit: 845321c7088aa9b1aa2d715b87aa0d052e2ca976 * [Release] sdk/resourcemanager/mariadb/armmariadb/0.3.0 generation from spec commit: 845321c7088aa9b1aa2d715b87aa0d052e2ca976 * [Release] sdk/resourcemanager/marketplace/armmarketplace/0.3.0 generation from spec commit: 845321c7088aa9b1aa2d715b87aa0d052e2ca976 * [Release] sdk/resourcemanager/marketplaceordering/armmarketplaceordering/0.3.0 generation from spec commit: 845321c7088aa9b1aa2d715b87aa0d052e2ca976 * [Release] sdk/resourcemanager/mediaservices/armmediaservices/0.5.0 generation from spec commit: 845321c7088aa9b1aa2d715b87aa0d052e2ca976 * update README.md --- .../armmachinelearningservices/CHANGELOG.md | 356 ++ .../armmachinelearningservices/README.md | 12 +- .../armmachinelearningservices/autorest.md | 6 +- .../armmachinelearningservices/go.mod | 19 +- .../armmachinelearningservices/go.sum | 20 +- ...e_generated_example_compute_client_test.go | 218 +- ..._privateendpointconnections_client_test.go | 75 +- ...xample_privatelinkresources_client_test.go | 19 +- ...ze_generated_example_quotas_client_test.go | 59 +- ...ze_generated_example_usages_client_test.go | 28 +- ...example_virtualmachinesizes_client_test.go | 19 +- ...xample_workspaceconnections_client_test.go | 83 +- ...d_example_workspacefeatures_client_test.go | 28 +- ...enerated_example_workspaces_client_test.go | 312 +- ...rated_example_workspaceskus_client_test.go | 28 +- .../zz_generated_compute_client.go | 243 +- .../zz_generated_constants.go | 171 +- .../zz_generated_models.go | 1773 +------ .../zz_generated_models_serde.go | 1725 +++++++ .../zz_generated_operations_client.go | 62 +- .../zz_generated_pagers.go | 449 -- .../zz_generated_pollers.go | 488 -- .../zz_generated_polymorphic_helpers.go | 4 +- ...rated_privateendpointconnections_client.go | 68 +- ...z_generated_privatelinkresources_client.go | 29 +- .../zz_generated_quotas_client.go | 63 +- .../zz_generated_response_types.go | 703 +-- .../zz_generated_time_rfc3339.go | 4 +- .../zz_generated_usages_client.go | 61 +- ...zz_generated_virtualmachinesizes_client.go | 29 +- ...z_generated_workspaceconnections_client.go | 68 +- .../zz_generated_workspacefeatures_client.go | 61 +- .../zz_generated_workspaces_client.go | 233 +- .../zz_generated_workspaceskus_client.go | 61 +- .../maintenance/armmaintenance/CHANGELOG.md | 151 + .../maintenance/armmaintenance/README.md | 12 +- .../maintenance/armmaintenance/autorest.md | 6 +- .../maintenance/armmaintenance/go.mod | 19 +- .../maintenance/armmaintenance/go.sum | 20 +- ...applyupdateforresourcegroup_client_test.go | 29 +- ...erated_example_applyupdates_client_test.go | 87 +- ...le_configurationassignments_client_test.go | 148 +- ...signmentswithinsubscription_client_test.go | 27 +- ...e_maintenanceconfigurations_client_test.go | 123 +- ...figurationsforresourcegroup_client_test.go | 29 +- ...enerated_example_operations_client_test.go | 27 +- ...icmaintenanceconfigurations_client_test.go | 42 +- ...e_generated_example_updates_client_test.go | 54 +- ...ated_applyupdateforresourcegroup_client.go | 62 +- .../zz_generated_applyupdates_client.go | 70 +- ...nerated_configurationassignments_client.go | 109 +- ...ionassignmentswithinsubscription_client.go | 62 +- .../zz_generated_configurations_client.go | 70 +- ...d_configurationsforresourcegroup_client.go | 62 +- .../armmaintenance/zz_generated_constants.go | 41 +- .../armmaintenance/zz_generated_models.go | 255 +- .../zz_generated_models_serde.go | 257 + .../zz_generated_operations_client.go | 62 +- ..._publicmaintenanceconfigurations_client.go | 64 +- .../zz_generated_response_types.go | 188 +- .../zz_generated_time_rfc3339.go | 4 +- .../zz_generated_updates_client.go | 97 +- .../armmanagedservices/CHANGELOG.md | 134 + .../armmanagedservices/README.md | 12 +- .../armmanagedservices/autorest.md | 6 +- .../managedservices/armmanagedservices/go.mod | 19 +- .../managedservices/armmanagedservices/go.sum | 20 +- ...laceregistrationdefinitions_client_test.go | 45 +- ...tiondefinitionswithoutscope_client_test.go | 45 +- ...enerated_example_operations_client_test.go | 19 +- ...example_operationswithscope_client_test.go | 41 + ...ple_registrationassignments_client_test.go | 86 +- ...ple_registrationdefinitions_client_test.go | 119 +- .../zz_generated_constants.go | 36 +- ...rketplaceregistrationdefinitions_client.go | 67 +- ...istrationdefinitionswithoutscope_client.go | 67 +- .../armmanagedservices/zz_generated_models.go | 170 +- .../zz_generated_models_serde.go | 180 + .../zz_generated_operations_client.go | 31 +- ...zz_generated_operationswithscope_client.go | 94 + .../armmanagedservices/zz_generated_pagers.go | 233 - .../zz_generated_pollers.go | 144 - ...enerated_registrationassignments_client.go | 122 +- ...enerated_registrationdefinitions_client.go | 100 +- .../zz_generated_response_types.go | 215 +- .../zz_generated_time_rfc3339.go | 85 + .../armmanagementgroups/CHANGELOG.md | 146 + .../armmanagementgroups/README.md | 12 +- .../armmanagementgroups/autorest.md | 6 +- .../armmanagementgroups/go.mod | 19 +- .../armmanagementgroups/go.sum | 17 +- ..._generated_example_entities_client_test.go | 28 +- ...d_example_hierarchysettings_client_test.go | 84 +- ...ed_example_managementgroups_client_test.go | 137 +- ...example_managementgroupsapi_client_test.go | 53 +- ...anagementgroupsubscriptions_client_test.go | 76 +- ...enerated_example_operations_client_test.go | 28 +- .../zz_generated_api_client.go | 29 +- .../zz_generated_client.go | 147 +- .../zz_generated_constants.go | 41 +- .../zz_generated_entities_client.go | 57 +- .../zz_generated_hierarchysettings_client.go | 33 +- ...ted_managementgroupsubscriptions_client.go | 63 +- .../zz_generated_models.go | 300 +- .../zz_generated_models_serde.go | 253 + .../zz_generated_operations_client.go | 57 +- .../zz_generated_pagers.go | 287 -- .../zz_generated_pollers.go | 101 - .../zz_generated_response_types.go | 223 +- .../zz_generated_time_rfc3339.go | 4 +- .../armmanagementpartner/CHANGELOG.md | 38 + .../armmanagementpartner/README.md | 12 +- .../armmanagementpartner/autorest.md | 6 +- .../armmanagementpartner/go.mod | 19 +- .../armmanagementpartner/go.sum | 20 +- ...generated_example_operation_client_test.go | 28 +- ...e_generated_example_partner_client_test.go | 61 +- ..._generated_example_partners_client_test.go | 19 +- .../zz_generated_constants.go | 11 +- .../zz_generated_models.go | 91 +- .../zz_generated_models_serde.go | 95 + .../zz_generated_operation_client.go | 61 +- .../zz_generated_pagers.go | 71 - .../zz_generated_partner_client.go | 35 +- .../zz_generated_partners_client.go | 29 +- .../zz_generated_response_types.go | 44 +- .../zz_generated_time_rfc3339.go | 4 +- sdk/resourcemanager/maps/armmaps/CHANGELOG.md | 101 + sdk/resourcemanager/maps/armmaps/README.md | 12 +- sdk/resourcemanager/maps/armmaps/autorest.md | 6 +- sdk/resourcemanager/maps/armmaps/go.mod | 19 +- sdk/resourcemanager/maps/armmaps/go.sum | 20 +- ..._generated_example_accounts_client_test.go | 198 +- ..._generated_example_creators_client_test.go | 95 +- .../ze_generated_example_maps_client_test.go | 52 +- .../armmaps/zz_generated_accounts_client.go | 109 +- .../maps/armmaps/zz_generated_client.go | 95 +- .../maps/armmaps/zz_generated_constants.go | 36 +- .../armmaps/zz_generated_creators_client.go | 69 +- .../maps/armmaps/zz_generated_models.go | 242 +- .../maps/armmaps/zz_generated_models_serde.go | 244 + .../maps/armmaps/zz_generated_pagers.go | 287 -- .../armmaps/zz_generated_response_types.go | 110 +- .../maps/armmaps/zz_generated_time_rfc3339.go | 4 +- .../mariadb/armmariadb/CHANGELOG.md | 507 ++ .../mariadb/armmariadb/README.md | 12 +- .../mariadb/armmariadb/autorest.md | 6 +- sdk/resourcemanager/mariadb/armmariadb/go.mod | 19 +- sdk/resourcemanager/mariadb/armmariadb/go.sum | 20 +- ..._generated_example_advisors_client_test.go | 43 +- ...ample_checknameavailability_client_test.go | 23 +- ...ated_example_configurations_client_test.go | 68 +- ...generated_example_databases_client_test.go | 85 +- ...rated_example_firewallrules_client_test.go | 85 +- ...ocationbasedperformancetier_client_test.go | 29 +- ...tionsessionsoperationstatus_client_test.go | 19 +- ...mmendedactionsessionsresult_client_test.go | 28 +- ..._generated_example_logfiles_client_test.go | 29 +- ...ple_mariadbmanagementclient_client_test.go | 36 +- ...enerated_example_operations_client_test.go | 19 +- ..._privateendpointconnections_client_test.go | 108 +- ...xample_privatelinkresources_client_test.go | 43 +- ...enerated_example_querytexts_client_test.go | 43 +- ..._example_recommendedactions_client_test.go | 43 +- ..._example_recoverableservers_client_test.go | 19 +- ..._generated_example_replicas_client_test.go | 29 +- ..._serverbasedperformancetier_client_test.go | 29 +- ...ed_example_serverparameters_client_test.go | 24 +- ...e_generated_example_servers_client_test.go | 197 +- ...serversecurityalertpolicies_client_test.go | 83 +- ..._example_topquerystatistics_client_test.go | 55 +- ...example_virtualnetworkrules_client_test.go | 84 +- ...ated_example_waitstatistics_client_test.go | 49 +- .../zz_generated_advisors_client.go | 63 +- ..._generated_checknameavailability_client.go | 29 +- .../zz_generated_configurations_client.go | 88 +- .../armmariadb/zz_generated_constants.go | 91 +- .../zz_generated_databases_client.go | 112 +- .../zz_generated_firewallrules_client.go | 112 +- ...ted_locationbasedperformancetier_client.go | 62 +- ...dedactionsessionsoperationstatus_client.go | 29 +- ...drecommendedactionsessionsresult_client.go | 61 +- .../zz_generated_logfiles_client.go | 62 +- .../zz_generated_management_client.go | 53 +- .../mariadb/armmariadb/zz_generated_models.go | 1024 +--- .../armmariadb/zz_generated_models_serde.go | 965 ++++ .../zz_generated_operations_client.go | 29 +- .../mariadb/armmariadb/zz_generated_pagers.go | 557 -- .../armmariadb/zz_generated_pollers.go | 832 --- .../zz_generated_polymorphic_helpers.go | 4 +- ...rated_privateendpointconnections_client.go | 135 +- ...z_generated_privatelinkresources_client.go | 63 +- .../zz_generated_querytexts_client.go | 63 +- .../zz_generated_recommendedactions_client.go | 63 +- .../zz_generated_recoverableservers_client.go | 29 +- .../zz_generated_replicas_client.go | 62 +- .../armmariadb/zz_generated_response_types.go | 1127 +--- ...rated_serverbasedperformancetier_client.go | 62 +- .../zz_generated_serverparameters_client.go | 53 +- .../armmariadb/zz_generated_servers_client.go | 243 +- ...ated_serversecurityalertpolicies_client.go | 87 +- .../armmariadb/zz_generated_time_rfc3339.go | 4 +- .../zz_generated_topquerystatistics_client.go | 63 +- ...zz_generated_virtualnetworkrules_client.go | 111 +- .../zz_generated_waitstatistics_client.go | 63 +- .../marketplace/armmarketplace/CHANGELOG.md | 160 + .../marketplace/armmarketplace/README.md | 12 +- .../marketplace/armmarketplace/autorest.md | 6 +- .../marketplace/armmarketplace/go.mod | 19 +- .../marketplace/armmarketplace/go.sum | 20 +- ...enerated_example_operations_client_test.go | 40 + ...erated_example_privatestore_client_test.go | 436 +- ...mple_privatestorecollection_client_test.go | 108 +- ...privatestorecollectionoffer_client_test.go | 88 +- .../armmarketplace/zz_generated_constants.go | 54 +- .../armmarketplace/zz_generated_models.go | 474 +- .../zz_generated_models_serde.go | 436 ++ .../zz_generated_operations_client.go | 31 +- .../armmarketplace/zz_generated_pagers.go | 125 - .../zz_generated_privatestore_client.go | 329 +- ...generated_privatestorecollection_client.go | 51 +- ...ated_privatestorecollectionoffer_client.go | 79 +- .../zz_generated_response_types.go | 207 +- .../zz_generated_time_rfc3339.go | 4 +- .../armmarketplaceordering/CHANGELOG.md | 45 + .../armmarketplaceordering/README.md | 12 +- .../armmarketplaceordering/autorest.md | 6 +- .../armmarketplaceordering/go.mod | 19 +- .../armmarketplaceordering/go.sum | 20 +- ...ample_marketplaceagreements_client_test.go | 116 +- .../zz_generated_constants.go | 16 +- ..._generated_marketplaceagreements_client.go | 39 +- .../zz_generated_models.go | 142 +- .../zz_generated_models_serde.go | 146 + .../zz_generated_operations_client.go | 61 +- .../zz_generated_pagers.go | 71 - .../zz_generated_response_types.go | 55 +- .../zz_generated_time_rfc3339.go | 4 +- .../armmediaservices/CHANGELOG.md | 642 +++ .../mediaservices/armmediaservices/README.md | 12 +- .../armmediaservices/autorest.md | 6 +- .../mediaservices/armmediaservices/go.mod | 19 +- .../mediaservices/armmediaservices/go.sum | 17 +- ...ated_example_accountfilters_client_test.go | 143 +- ...erated_example_assetfilters_client_test.go | 143 +- ...ze_generated_example_assets_client_test.go | 144 +- ..._example_contentkeypolicies_client_test.go | 126 +- .../ze_generated_example_jobs_client_test.go | 122 +- ...enerated_example_liveevents_client_test.go | 218 +- ...nerated_example_liveoutputs_client_test.go | 90 +- ...generated_example_locations_client_test.go | 23 +- ...rated_example_mediaservices_client_test.go | 168 +- ...ed_example_operationresults_client_test.go | 19 +- ...enerated_example_operations_client_test.go | 19 +- ...d_example_operationstatuses_client_test.go | 19 +- ..._privateendpointconnections_client_test.go | 65 +- ...xample_privatelinkresources_client_test.go | 34 +- ..._example_streamingendpoints_client_test.go | 197 +- ...d_example_streaminglocators_client_test.go | 101 +- ...d_example_streamingpolicies_client_test.go | 75 +- ...ze_generated_example_tracks_client_test.go | 127 +- ...enerated_example_transforms_client_test.go | 99 +- .../zz_generated_accountfilters_client.go | 65 +- .../zz_generated_assetfilters_client.go | 65 +- .../zz_generated_assets_client.go | 71 +- .../armmediaservices/zz_generated_client.go | 103 +- .../zz_generated_constants.go | 316 +- .../zz_generated_contentkeypolicies_client.go | 67 +- .../zz_generated_jobs_client.go | 67 +- .../zz_generated_liveevents_client.go | 227 +- .../zz_generated_liveoutputs_client.go | 107 +- .../zz_generated_locations_client.go | 25 +- .../armmediaservices/zz_generated_models.go | 4575 +---------------- .../zz_generated_models_serde.go | 4521 ++++++++++++++++ .../zz_generated_operationresults_client.go | 25 +- .../zz_generated_operations_client.go | 25 +- .../zz_generated_operationstatuses_client.go | 25 +- .../armmediaservices/zz_generated_pagers.go | 719 --- .../armmediaservices/zz_generated_pollers.go | 832 --- .../zz_generated_polymorphic_helpers.go | 4 +- ...rated_privateendpointconnections_client.go | 31 +- ...z_generated_privatelinkresources_client.go | 27 +- .../zz_generated_response_types.go | 1312 +---- .../zz_generated_streamingendpoints_client.go | 205 +- .../zz_generated_streaminglocators_client.go | 67 +- .../zz_generated_streamingpolicies_client.go | 63 +- .../zz_generated_time_rfc3339.go | 4 +- .../zz_generated_tracks_client.go | 156 +- .../zz_generated_transforms_client.go | 65 +- 289 files changed, 20564 insertions(+), 23887 deletions(-) create mode 100644 sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_models_serde.go delete mode 100644 sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_pagers.go delete mode 100644 sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_pollers.go create mode 100644 sdk/resourcemanager/maintenance/armmaintenance/zz_generated_models_serde.go create mode 100644 sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_operationswithscope_client_test.go create mode 100644 sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_models_serde.go create mode 100644 sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_operationswithscope_client.go delete mode 100644 sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_pagers.go delete mode 100644 sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_pollers.go create mode 100644 sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_time_rfc3339.go create mode 100644 sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models_serde.go delete mode 100644 sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pagers.go delete mode 100644 sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pollers.go create mode 100644 sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_models_serde.go delete mode 100644 sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/maps/armmaps/zz_generated_models_serde.go delete mode 100644 sdk/resourcemanager/maps/armmaps/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/mariadb/armmariadb/zz_generated_models_serde.go delete mode 100644 sdk/resourcemanager/mariadb/armmariadb/zz_generated_pagers.go delete mode 100644 sdk/resourcemanager/mariadb/armmariadb/zz_generated_pollers.go create mode 100644 sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_operations_client_test.go create mode 100644 sdk/resourcemanager/marketplace/armmarketplace/zz_generated_models_serde.go delete mode 100644 sdk/resourcemanager/marketplace/armmarketplace/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_models_serde.go delete mode 100644 sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models_serde.go delete mode 100644 sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pagers.go delete mode 100644 sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pollers.go diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/CHANGELOG.md b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/CHANGELOG.md index 1ab1c07ed9b7..1915d9a1cbc4 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/CHANGELOG.md +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/CHANGELOG.md @@ -1,5 +1,361 @@ # Release History +## 0.3.0 (2022-04-12) +### Breaking Changes + +- Function `*ComputeClient.List` return value(s) have been changed from `(*ComputeClientListPager)` to `(*runtime.Pager[ComputeClientListResponse])` +- Function `*ComputeClient.ListNodes` return value(s) have been changed from `(*ComputeClientListNodesPager)` to `(*runtime.Pager[ComputeClientListNodesResponse])` +- Function `*PrivateEndpointConnectionsClient.List` parameter(s) have been changed from `(context.Context, string, string, *PrivateEndpointConnectionsClientListOptions)` to `(string, string, *PrivateEndpointConnectionsClientListOptions)` +- Function `*PrivateEndpointConnectionsClient.List` return value(s) have been changed from `(PrivateEndpointConnectionsClientListResponse, error)` to `(*runtime.Pager[PrivateEndpointConnectionsClientListResponse])` +- Function `*WorkspaceSKUsClient.List` return value(s) have been changed from `(*WorkspaceSKUsClientListPager)` to `(*runtime.Pager[WorkspaceSKUsClientListResponse])` +- Function `*ComputeClient.BeginRestart` return value(s) have been changed from `(ComputeClientRestartPollerResponse, error)` to `(*armruntime.Poller[ComputeClientRestartResponse], error)` +- Function `*WorkspacesClient.BeginCreateOrUpdate` return value(s) have been changed from `(WorkspacesClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[WorkspacesClientCreateOrUpdateResponse], error)` +- Function `*ComputeClient.BeginStop` return value(s) have been changed from `(ComputeClientStopPollerResponse, error)` to `(*armruntime.Poller[ComputeClientStopResponse], error)` +- Function `*WorkspacesClient.ListByResourceGroup` return value(s) have been changed from `(*WorkspacesClientListByResourceGroupPager)` to `(*runtime.Pager[WorkspacesClientListByResourceGroupResponse])` +- Function `*UsagesClient.List` return value(s) have been changed from `(*UsagesClientListPager)` to `(*runtime.Pager[UsagesClientListResponse])` +- Function `NewWorkspacesClient` return value(s) have been changed from `(*WorkspacesClient)` to `(*WorkspacesClient, error)` +- Function `*ComputeClient.BeginCreateOrUpdate` return value(s) have been changed from `(ComputeClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[ComputeClientCreateOrUpdateResponse], error)` +- Function `*OperationsClient.List` parameter(s) have been changed from `(context.Context, *OperationsClientListOptions)` to `(*OperationsClientListOptions)` +- Function `*OperationsClient.List` return value(s) have been changed from `(OperationsClientListResponse, error)` to `(*runtime.Pager[OperationsClientListResponse])` +- Function `*QuotasClient.List` return value(s) have been changed from `(*QuotasClientListPager)` to `(*runtime.Pager[QuotasClientListResponse])` +- Function `NewPrivateLinkResourcesClient` return value(s) have been changed from `(*PrivateLinkResourcesClient)` to `(*PrivateLinkResourcesClient, error)` +- Function `NewVirtualMachineSizesClient` return value(s) have been changed from `(*VirtualMachineSizesClient)` to `(*VirtualMachineSizesClient, error)` +- Function `NewPrivateEndpointConnectionsClient` return value(s) have been changed from `(*PrivateEndpointConnectionsClient)` to `(*PrivateEndpointConnectionsClient, error)` +- Function `NewUsagesClient` return value(s) have been changed from `(*UsagesClient)` to `(*UsagesClient, error)` +- Function `*ComputeClient.BeginStart` return value(s) have been changed from `(ComputeClientStartPollerResponse, error)` to `(*armruntime.Poller[ComputeClientStartResponse], error)` +- Function `*ComputeClient.BeginDelete` return value(s) have been changed from `(ComputeClientDeletePollerResponse, error)` to `(*armruntime.Poller[ComputeClientDeleteResponse], error)` +- Function `*WorkspaceConnectionsClient.List` parameter(s) have been changed from `(context.Context, string, string, *WorkspaceConnectionsClientListOptions)` to `(string, string, *WorkspaceConnectionsClientListOptions)` +- Function `*WorkspaceConnectionsClient.List` return value(s) have been changed from `(WorkspaceConnectionsClientListResponse, error)` to `(*runtime.Pager[WorkspaceConnectionsClientListResponse])` +- Function `*WorkspacesClient.BeginDelete` return value(s) have been changed from `(WorkspacesClientDeletePollerResponse, error)` to `(*armruntime.Poller[WorkspacesClientDeleteResponse], error)` +- Function `NewQuotasClient` return value(s) have been changed from `(*QuotasClient)` to `(*QuotasClient, error)` +- Function `*WorkspacesClient.BeginDiagnose` return value(s) have been changed from `(WorkspacesClientDiagnosePollerResponse, error)` to `(*armruntime.Poller[WorkspacesClientDiagnoseResponse], error)` +- Function `NewWorkspaceConnectionsClient` return value(s) have been changed from `(*WorkspaceConnectionsClient)` to `(*WorkspaceConnectionsClient, error)` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `NewWorkspaceSKUsClient` return value(s) have been changed from `(*WorkspaceSKUsClient)` to `(*WorkspaceSKUsClient, error)` +- Function `*WorkspacesClient.BeginPrepareNotebook` return value(s) have been changed from `(WorkspacesClientPrepareNotebookPollerResponse, error)` to `(*armruntime.Poller[WorkspacesClientPrepareNotebookResponse], error)` +- Function `NewWorkspaceFeaturesClient` return value(s) have been changed from `(*WorkspaceFeaturesClient)` to `(*WorkspaceFeaturesClient, error)` +- Function `NewComputeClient` return value(s) have been changed from `(*ComputeClient)` to `(*ComputeClient, error)` +- Function `*WorkspacesClient.ListBySubscription` return value(s) have been changed from `(*WorkspacesClientListBySubscriptionPager)` to `(*runtime.Pager[WorkspacesClientListBySubscriptionResponse])` +- Function `*ComputeClient.BeginUpdate` return value(s) have been changed from `(ComputeClientUpdatePollerResponse, error)` to `(*armruntime.Poller[ComputeClientUpdateResponse], error)` +- Function `*WorkspacesClient.BeginResyncKeys` return value(s) have been changed from `(WorkspacesClientResyncKeysPollerResponse, error)` to `(*armruntime.Poller[WorkspacesClientResyncKeysResponse], error)` +- Function `*WorkspaceFeaturesClient.List` return value(s) have been changed from `(*WorkspaceFeaturesClientListPager)` to `(*runtime.Pager[WorkspaceFeaturesClientListResponse])` +- Type of `DiagnoseRequestProperties.Nsg` has been changed from `map[string]map[string]interface{}` to `map[string]interface{}` +- Type of `DiagnoseRequestProperties.StorageAccount` has been changed from `map[string]map[string]interface{}` to `map[string]interface{}` +- Type of `DiagnoseRequestProperties.Udr` has been changed from `map[string]map[string]interface{}` to `map[string]interface{}` +- Type of `DiagnoseRequestProperties.ApplicationInsights` has been changed from `map[string]map[string]interface{}` to `map[string]interface{}` +- Type of `DiagnoseRequestProperties.DNSResolution` has been changed from `map[string]map[string]interface{}` to `map[string]interface{}` +- Type of `DiagnoseRequestProperties.KeyVault` has been changed from `map[string]map[string]interface{}` to `map[string]interface{}` +- Type of `DiagnoseRequestProperties.ResourceLock` has been changed from `map[string]map[string]interface{}` to `map[string]interface{}` +- Type of `DiagnoseRequestProperties.ContainerRegistry` has been changed from `map[string]map[string]interface{}` to `map[string]interface{}` +- Type of `DiagnoseRequestProperties.Others` has been changed from `map[string]map[string]interface{}` to `map[string]interface{}` +- Type of `ErrorAdditionalInfo.Info` has been changed from `map[string]interface{}` to `interface{}` +- Function `*ComputeClientListPager.PageResponse` has been removed +- Function `*WorkspacesClientCreateOrUpdatePoller.Done` has been removed +- Function `CreatedByType.ToPtr` has been removed +- Function `*ComputeClientDeletePoller.Poll` has been removed +- Function `*WorkspacesClientDeletePoller.Poll` has been removed +- Function `*WorkspacesClientPrepareNotebookPoller.Poll` has been removed +- Function `*ComputeClientDeletePollerResponse.Resume` has been removed +- Function `ReasonCode.ToPtr` has been removed +- Function `*WorkspacesClientListBySubscriptionPager.PageResponse` has been removed +- Function `*ComputeClientListNodesPager.NextPage` has been removed +- Function `*ComputeClientStopPoller.ResumeToken` has been removed +- Function `ClusterPurpose.ToPtr` has been removed +- Function `*ComputeClientCreateOrUpdatePoller.Done` has been removed +- Function `RemoteLoginPortPublicAccess.ToPtr` has been removed +- Function `*ComputeClientStartPoller.Poll` has been removed +- Function `*ComputeClientStartPoller.ResumeToken` has been removed +- Function `*WorkspaceFeaturesClientListPager.PageResponse` has been removed +- Function `WorkspacesClientPrepareNotebookPollerResponse.PollUntilDone` has been removed +- Function `ComputeInstanceAuthorizationType.ToPtr` has been removed +- Function `*ComputeClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*ComputeClientListNodesPager.PageResponse` has been removed +- Function `*WorkspacesClientResyncKeysPoller.FinalResponse` has been removed +- Function `UnitOfMeasure.ToPtr` has been removed +- Function `Status.ToPtr` has been removed +- Function `*UsagesClientListPager.Err` has been removed +- Function `ComputeClientRestartPollerResponse.PollUntilDone` has been removed +- Function `*WorkspacesClientResyncKeysPoller.ResumeToken` has been removed +- Function `*WorkspacesClientDeletePoller.Done` has been removed +- Function `*ComputeClientRestartPollerResponse.Resume` has been removed +- Function `*WorkspacesClientResyncKeysPoller.Poll` has been removed +- Function `OperationName.ToPtr` has been removed +- Function `*ComputeClientUpdatePoller.ResumeToken` has been removed +- Function `UnderlyingResourceAction.ToPtr` has been removed +- Function `*WorkspacesClientListByResourceGroupPager.NextPage` has been removed +- Function `*WorkspacesClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `VMTier.ToPtr` has been removed +- Function `NodeState.ToPtr` has been removed +- Function `UsageUnit.ToPtr` has been removed +- Function `ComputeClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*ComputeClientStartPollerResponse.Resume` has been removed +- Function `*WorkspacesClientDeletePollerResponse.Resume` has been removed +- Function `DiagnoseResultLevel.ToPtr` has been removed +- Function `ComputeInstanceState.ToPtr` has been removed +- Function `*WorkspaceFeaturesClientListPager.Err` has been removed +- Function `ResourceIdentityType.ToPtr` has been removed +- Function `ApplicationSharingPolicy.ToPtr` has been removed +- Function `*ComputeClientRestartPoller.ResumeToken` has been removed +- Function `*ComputeClientUpdatePoller.Done` has been removed +- Function `PrivateEndpointConnectionProvisioningState.ToPtr` has been removed +- Function `QuotaUnit.ToPtr` has been removed +- Function `*WorkspacesClientDiagnosePoller.Poll` has been removed +- Function `ValueFormat.ToPtr` has been removed +- Function `*WorkspacesClientPrepareNotebookPollerResponse.Resume` has been removed +- Function `*ComputeClientDeletePoller.Done` has been removed +- Function `*QuotasClientListPager.Err` has been removed +- Function `ComputeType.ToPtr` has been removed +- Function `PrivateEndpointServiceConnectionStatus.ToPtr` has been removed +- Function `*ComputeClientRestartPoller.Done` has been removed +- Function `*WorkspacesClientDiagnosePollerResponse.Resume` has been removed +- Function `*UsagesClientListPager.PageResponse` has been removed +- Function `*WorkspacesClientPrepareNotebookPoller.Done` has been removed +- Function `SSLConfigurationStatus.ToPtr` has been removed +- Function `*WorkspacesClientCreateOrUpdatePoller.Poll` has been removed +- Function `AllocationState.ToPtr` has been removed +- Function `*ComputeClientListNodesPager.Err` has been removed +- Function `*ComputeClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*WorkspacesClientDeletePoller.ResumeToken` has been removed +- Function `*WorkspacesClientPrepareNotebookPoller.ResumeToken` has been removed +- Function `OsType.ToPtr` has been removed +- Function `WorkspacesClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*WorkspacesClientPrepareNotebookPoller.FinalResponse` has been removed +- Function `*ComputeClientCreateOrUpdatePoller.Poll` has been removed +- Function `ProvisioningState.ToPtr` has been removed +- Function `*WorkspacesClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*WorkspaceSKUsClientListPager.PageResponse` has been removed +- Function `*ComputeClientStopPoller.FinalResponse` has been removed +- Function `*WorkspaceFeaturesClientListPager.NextPage` has been removed +- Function `OperationStatus.ToPtr` has been removed +- Function `*ComputeClientStopPoller.Done` has been removed +- Function `*WorkspacesClientListByResourceGroupPager.Err` has been removed +- Function `*WorkspacesClientResyncKeysPoller.Done` has been removed +- Function `*WorkspacesClientListByResourceGroupPager.PageResponse` has been removed +- Function `*ComputeClientStopPoller.Poll` has been removed +- Function `WorkspacesClientResyncKeysPollerResponse.PollUntilDone` has been removed +- Function `*WorkspaceSKUsClientListPager.Err` has been removed +- Function `*WorkspacesClientDiagnosePoller.Done` has been removed +- Function `WorkspacesClientDeletePollerResponse.PollUntilDone` has been removed +- Function `WorkspacesClientDiagnosePollerResponse.PollUntilDone` has been removed +- Function `*WorkspacesClientDiagnosePoller.FinalResponse` has been removed +- Function `*ComputeClientUpdatePoller.Poll` has been removed +- Function `PublicNetworkAccess.ToPtr` has been removed +- Function `*WorkspacesClientDeletePoller.FinalResponse` has been removed +- Function `VMPriceOSType.ToPtr` has been removed +- Function `*ComputeClientListPager.NextPage` has been removed +- Function `BillingCurrency.ToPtr` has been removed +- Function `*WorkspacesClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*ComputeClientListPager.Err` has been removed +- Function `*ComputeClientRestartPoller.FinalResponse` has been removed +- Function `*ComputeClientRestartPoller.Poll` has been removed +- Function `*ComputeClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*ComputeClientUpdatePoller.FinalResponse` has been removed +- Function `*QuotasClientListPager.NextPage` has been removed +- Function `*ComputeClientStartPoller.FinalResponse` has been removed +- Function `EncryptionStatus.ToPtr` has been removed +- Function `*WorkspacesClientResyncKeysPollerResponse.Resume` has been removed +- Function `*QuotasClientListPager.PageResponse` has been removed +- Function `VMPriority.ToPtr` has been removed +- Function `*WorkspacesClientListBySubscriptionPager.Err` has been removed +- Function `*ComputeClientDeletePoller.FinalResponse` has been removed +- Function `*WorkspaceSKUsClientListPager.NextPage` has been removed +- Function `*ComputeClientListKeysResult.UnmarshalJSON` has been removed +- Function `*UsagesClientListPager.NextPage` has been removed +- Function `*ComputeClientDeletePoller.ResumeToken` has been removed +- Function `ComputeClientUpdatePollerResponse.PollUntilDone` has been removed +- Function `ComputeClientStartPollerResponse.PollUntilDone` has been removed +- Function `ComputeClientStopPollerResponse.PollUntilDone` has been removed +- Function `*ComputeClientStopPollerResponse.Resume` has been removed +- Function `SSHPublicAccess.ToPtr` has been removed +- Function `*ComputeClientStartPoller.Done` has been removed +- Function `LoadBalancerType.ToPtr` has been removed +- Function `ComputeClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*ComputeClientUpdatePollerResponse.Resume` has been removed +- Function `*WorkspacesClientListBySubscriptionPager.NextPage` has been removed +- Function `*WorkspacesClientDiagnosePoller.ResumeToken` has been removed +- Struct `ComputeClientCreateOrUpdatePoller` has been removed +- Struct `ComputeClientCreateOrUpdatePollerResponse` has been removed +- Struct `ComputeClientCreateOrUpdateResult` has been removed +- Struct `ComputeClientDeletePoller` has been removed +- Struct `ComputeClientDeletePollerResponse` has been removed +- Struct `ComputeClientGetResult` has been removed +- Struct `ComputeClientListKeysResult` has been removed +- Struct `ComputeClientListNodesPager` has been removed +- Struct `ComputeClientListNodesResult` has been removed +- Struct `ComputeClientListPager` has been removed +- Struct `ComputeClientListResult` has been removed +- Struct `ComputeClientRestartPoller` has been removed +- Struct `ComputeClientRestartPollerResponse` has been removed +- Struct `ComputeClientStartPoller` has been removed +- Struct `ComputeClientStartPollerResponse` has been removed +- Struct `ComputeClientStopPoller` has been removed +- Struct `ComputeClientStopPollerResponse` has been removed +- Struct `ComputeClientUpdatePoller` has been removed +- Struct `ComputeClientUpdatePollerResponse` has been removed +- Struct `ComputeClientUpdateResult` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `PrivateEndpointConnectionsClientCreateOrUpdateResult` has been removed +- Struct `PrivateEndpointConnectionsClientGetResult` has been removed +- Struct `PrivateEndpointConnectionsClientListResult` has been removed +- Struct `PrivateLinkResourcesClientListResult` has been removed +- Struct `QuotasClientListPager` has been removed +- Struct `QuotasClientListResult` has been removed +- Struct `QuotasClientUpdateResult` has been removed +- Struct `UsagesClientListPager` has been removed +- Struct `UsagesClientListResult` has been removed +- Struct `VirtualMachineSizesClientListResult` has been removed +- Struct `WorkspaceConnectionsClientCreateResult` has been removed +- Struct `WorkspaceConnectionsClientGetResult` has been removed +- Struct `WorkspaceConnectionsClientListResult` has been removed +- Struct `WorkspaceFeaturesClientListPager` has been removed +- Struct `WorkspaceFeaturesClientListResult` has been removed +- Struct `WorkspaceSKUsClientListPager` has been removed +- Struct `WorkspaceSKUsClientListResult` has been removed +- Struct `WorkspacesClientCreateOrUpdatePoller` has been removed +- Struct `WorkspacesClientCreateOrUpdatePollerResponse` has been removed +- Struct `WorkspacesClientCreateOrUpdateResult` has been removed +- Struct `WorkspacesClientDeletePoller` has been removed +- Struct `WorkspacesClientDeletePollerResponse` has been removed +- Struct `WorkspacesClientDiagnosePoller` has been removed +- Struct `WorkspacesClientDiagnosePollerResponse` has been removed +- Struct `WorkspacesClientDiagnoseResult` has been removed +- Struct `WorkspacesClientGetResult` has been removed +- Struct `WorkspacesClientListByResourceGroupPager` has been removed +- Struct `WorkspacesClientListByResourceGroupResult` has been removed +- Struct `WorkspacesClientListBySubscriptionPager` has been removed +- Struct `WorkspacesClientListBySubscriptionResult` has been removed +- Struct `WorkspacesClientListKeysResult` has been removed +- Struct `WorkspacesClientListNotebookAccessTokenResult` has been removed +- Struct `WorkspacesClientListNotebookKeysResult` has been removed +- Struct `WorkspacesClientListOutboundNetworkDependenciesEndpointsResult` has been removed +- Struct `WorkspacesClientListStorageAccountKeysResult` has been removed +- Struct `WorkspacesClientPrepareNotebookPoller` has been removed +- Struct `WorkspacesClientPrepareNotebookPollerResponse` has been removed +- Struct `WorkspacesClientPrepareNotebookResult` has been removed +- Struct `WorkspacesClientResyncKeysPoller` has been removed +- Struct `WorkspacesClientResyncKeysPollerResponse` has been removed +- Struct `WorkspacesClientUpdateResult` has been removed +- Field `ComputeClientListNodesResult` of struct `ComputeClientListNodesResponse` has been removed +- Field `RawResponse` of struct `ComputeClientListNodesResponse` has been removed +- Field `WorkspaceSKUsClientListResult` of struct `WorkspaceSKUsClientListResponse` has been removed +- Field `RawResponse` of struct `WorkspaceSKUsClientListResponse` has been removed +- Field `WorkspacesClientListBySubscriptionResult` of struct `WorkspacesClientListBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientListBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `WorkspaceConnectionsClientDeleteResponse` has been removed +- Field `PrivateEndpointConnectionsClientListResult` of struct `PrivateEndpointConnectionsClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientListResponse` has been removed +- Field `ComputeClientGetResult` of struct `ComputeClientGetResponse` has been removed +- Field `RawResponse` of struct `ComputeClientGetResponse` has been removed +- Field `PrivateEndpointConnectionsClientCreateOrUpdateResult` of struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` has been removed +- Field `VirtualMachineSizesClientListResult` of struct `VirtualMachineSizesClientListResponse` has been removed +- Field `RawResponse` of struct `VirtualMachineSizesClientListResponse` has been removed +- Field `ComputeClientCreateOrUpdateResult` of struct `ComputeClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ComputeClientCreateOrUpdateResponse` has been removed +- Field `WorkspacesClientGetResult` of struct `WorkspacesClientGetResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientGetResponse` has been removed +- Field `RawResponse` of struct `ComputeClientStartResponse` has been removed +- Field `ComputeClientUpdateResult` of struct `ComputeClientUpdateResponse` has been removed +- Field `RawResponse` of struct `ComputeClientUpdateResponse` has been removed +- Field `QuotasClientUpdateResult` of struct `QuotasClientUpdateResponse` has been removed +- Field `RawResponse` of struct `QuotasClientUpdateResponse` has been removed +- Field `PrivateLinkResourcesClientListResult` of struct `PrivateLinkResourcesClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateLinkResourcesClientListResponse` has been removed +- Field `RawResponse` of struct `ComputeClientRestartResponse` has been removed +- Field `PrivateEndpointConnectionsClientGetResult` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientDeleteResponse` has been removed +- Field `WorkspaceConnectionsClientListResult` of struct `WorkspaceConnectionsClientListResponse` has been removed +- Field `RawResponse` of struct `WorkspaceConnectionsClientListResponse` has been removed +- Field `QuotasClientListResult` of struct `QuotasClientListResponse` has been removed +- Field `RawResponse` of struct `QuotasClientListResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientResyncKeysResponse` has been removed +- Field `WorkspacesClientListStorageAccountKeysResult` of struct `WorkspacesClientListStorageAccountKeysResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientListStorageAccountKeysResponse` has been removed +- Field `ComputeClientListKeysResult` of struct `ComputeClientListKeysResponse` has been removed +- Field `RawResponse` of struct `ComputeClientListKeysResponse` has been removed +- Field `WorkspacesClientUpdateResult` of struct `WorkspacesClientUpdateResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientUpdateResponse` has been removed +- Field `WorkspacesClientPrepareNotebookResult` of struct `WorkspacesClientPrepareNotebookResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientPrepareNotebookResponse` has been removed +- Field `WorkspacesClientListNotebookKeysResult` of struct `WorkspacesClientListNotebookKeysResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientListNotebookKeysResponse` has been removed +- Field `WorkspacesClientListOutboundNetworkDependenciesEndpointsResult` of struct `WorkspacesClientListOutboundNetworkDependenciesEndpointsResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientListOutboundNetworkDependenciesEndpointsResponse` has been removed +- Field `WorkspacesClientListKeysResult` of struct `WorkspacesClientListKeysResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientListKeysResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientDeleteResponse` has been removed +- Field `WorkspaceFeaturesClientListResult` of struct `WorkspaceFeaturesClientListResponse` has been removed +- Field `RawResponse` of struct `WorkspaceFeaturesClientListResponse` has been removed +- Field `RawResponse` of struct `ComputeClientDeleteResponse` has been removed +- Field `ComputeClientListResult` of struct `ComputeClientListResponse` has been removed +- Field `RawResponse` of struct `ComputeClientListResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `WorkspacesClientCreateOrUpdateResult` of struct `WorkspacesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientCreateOrUpdateResponse` has been removed +- Field `WorkspacesClientDiagnoseResult` of struct `WorkspacesClientDiagnoseResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientDiagnoseResponse` has been removed +- Field `RawResponse` of struct `ComputeClientStopResponse` has been removed +- Field `WorkspaceConnectionsClientCreateResult` of struct `WorkspaceConnectionsClientCreateResponse` has been removed +- Field `RawResponse` of struct `WorkspaceConnectionsClientCreateResponse` has been removed +- Field `WorkspacesClientListByResourceGroupResult` of struct `WorkspacesClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientListByResourceGroupResponse` has been removed +- Field `WorkspaceConnectionsClientGetResult` of struct `WorkspaceConnectionsClientGetResponse` has been removed +- Field `RawResponse` of struct `WorkspaceConnectionsClientGetResponse` has been removed +- Field `WorkspacesClientListNotebookAccessTokenResult` of struct `WorkspacesClientListNotebookAccessTokenResponse` has been removed +- Field `RawResponse` of struct `WorkspacesClientListNotebookAccessTokenResponse` has been removed +- Field `UsagesClientListResult` of struct `UsagesClientListResponse` has been removed +- Field `RawResponse` of struct `UsagesClientListResponse` has been removed + +### Features Added + +- New function `*ComputeClientListKeysResponse.UnmarshalJSON([]byte) error` +- New anonymous field `ExternalFQDNResponse` in struct `WorkspacesClientListOutboundNetworkDependenciesEndpointsResponse` +- New anonymous field `ListWorkspaceQuotas` in struct `QuotasClientListResponse` +- New anonymous field `UpdateWorkspaceQuotasResult` in struct `QuotasClientUpdateResponse` +- New field `ResumeToken` in struct `ComputeClientBeginStopOptions` +- New field `ResumeToken` in struct `ComputeClientBeginUpdateOptions` +- New anonymous field `Workspace` in struct `WorkspacesClientGetResponse` +- New anonymous field `ComputeResource` in struct `ComputeClientCreateOrUpdateResponse` +- New anonymous field `Workspace` in struct `WorkspacesClientUpdateResponse` +- New anonymous field `ComputeResource` in struct `ComputeClientUpdateResponse` +- New anonymous field `VirtualMachineSizeListResult` in struct `VirtualMachineSizesClientListResponse` +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` +- New anonymous field `ComputeSecretsClassification` in struct `ComputeClientListKeysResponse` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New anonymous field `PaginatedComputeResourcesList` in struct `ComputeClientListResponse` +- New anonymous field `SKUListResult` in struct `WorkspaceSKUsClientListResponse` +- New anonymous field `Workspace` in struct `WorkspacesClientCreateOrUpdateResponse` +- New field `ResumeToken` in struct `ComputeClientBeginCreateOrUpdateOptions` +- New anonymous field `AmlComputeNodesInformation` in struct `ComputeClientListNodesResponse` +- New anonymous field `ListAmlUserFeatureResult` in struct `WorkspaceFeaturesClientListResponse` +- New field `ResumeToken` in struct `WorkspacesClientBeginPrepareNotebookOptions` +- New anonymous field `PrivateLinkResourceListResult` in struct `PrivateLinkResourcesClientListResponse` +- New anonymous field `WorkspaceListResult` in struct `WorkspacesClientListByResourceGroupResponse` +- New field `ResumeToken` in struct `WorkspacesClientBeginDeleteOptions` +- New anonymous field `ListStorageAccountKeysResult` in struct `WorkspacesClientListStorageAccountKeysResponse` +- New anonymous field `WorkspaceConnection` in struct `WorkspaceConnectionsClientGetResponse` +- New anonymous field `ComputeResource` in struct `ComputeClientGetResponse` +- New anonymous field `PrivateEndpointConnectionListResult` in struct `PrivateEndpointConnectionsClientListResponse` +- New anonymous field `NotebookAccessTokenResult` in struct `WorkspacesClientListNotebookAccessTokenResponse` +- New field `ResumeToken` in struct `WorkspacesClientBeginCreateOrUpdateOptions` +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsClientGetResponse` +- New anonymous field `ListNotebookKeysResult` in struct `WorkspacesClientListNotebookKeysResponse` +- New anonymous field `ListUsagesResult` in struct `UsagesClientListResponse` +- New anonymous field `NotebookResourceInfo` in struct `WorkspacesClientPrepareNotebookResponse` +- New anonymous field `DiagnoseResponseResult` in struct `WorkspacesClientDiagnoseResponse` +- New field `ResumeToken` in struct `WorkspacesClientBeginResyncKeysOptions` +- New field `ResumeToken` in struct `ComputeClientBeginRestartOptions` +- New anonymous field `PaginatedWorkspaceConnectionsList` in struct `WorkspaceConnectionsClientListResponse` +- New field `ResumeToken` in struct `ComputeClientBeginStartOptions` +- New anonymous field `WorkspaceConnection` in struct `WorkspaceConnectionsClientCreateResponse` +- New field `ResumeToken` in struct `WorkspacesClientBeginDiagnoseOptions` +- New anonymous field `ListWorkspaceKeysResult` in struct `WorkspacesClientListKeysResponse` +- New field `ResumeToken` in struct `ComputeClientBeginDeleteOptions` +- New anonymous field `WorkspaceListResult` in struct `WorkspacesClientListBySubscriptionResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/README.md b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/README.md index 7af74198e511..73f0b3ba182e 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/README.md +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/README.md @@ -11,7 +11,7 @@ The `armmachinelearningservices` module provides operations for working with Azu ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Machine Learning 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 -client := armmachinelearningservices.NewQuotasClient(, cred, nil) +client, err := armmachinelearningservices.NewQuotasClient(, cred, nil) ``` 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 -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armmachinelearningservices.NewQuotasClient(, cred, &options) +client, err := armmachinelearningservices.NewQuotasClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/autorest.md b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/autorest.md index 39c90e6c419c..6b12fe1b6daa 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/autorest.md +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/machinelearningservices/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/machinelearningservices/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/machinelearningservices/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/machinelearningservices/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/go.mod b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/go.mod index bc7b1208cda7..bd349be6bb92 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/go.mod +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearningservices/armmachinelearningservices -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/go.sum b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/go.sum +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm 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/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/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-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_compute_client_test.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_compute_client_test.go index 156f55385dec..9a4006deeb2f 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_compute_client_test.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_compute_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,109 +19,133 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearningservices/armmachinelearningservices" ) -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/list.json func ExampleComputeClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewComputeClient("", cred, nil) + client, err := armmachinelearningservices.NewComputeClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", &armmachinelearningservices.ComputeClientListOptions{Skip: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/get/AKSCompute.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/get/AKSCompute.json func ExampleComputeClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewComputeClient("", cred, nil) + client, err := armmachinelearningservices.NewComputeClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ComputeClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/createOrUpdate/KubernetesCompute.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/createOrUpdate/KubernetesCompute.json func ExampleComputeClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewComputeClient("", cred, nil) + client, err := armmachinelearningservices.NewComputeClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "", "", "", armmachinelearningservices.ComputeResource{ Properties: &armmachinelearningservices.Kubernetes{ - Description: to.StringPtr(""), - ComputeType: armmachinelearningservices.ComputeType("Kubernetes").ToPtr(), - ResourceID: to.StringPtr(""), + Description: to.Ptr(""), + ComputeType: to.Ptr(armmachinelearningservices.ComputeTypeKubernetes), + ResourceID: to.Ptr(""), Properties: &armmachinelearningservices.KubernetesProperties{ - DefaultInstanceType: to.StringPtr(""), + DefaultInstanceType: to.Ptr(""), InstanceTypes: map[string]*armmachinelearningservices.InstanceTypeSchema{ "defaultInstanceType": { Resources: &armmachinelearningservices.InstanceTypeSchemaResources{ Limits: map[string]*string{ - "cpu": to.StringPtr("1"), - "memory": to.StringPtr("4Gi"), + "cpu": to.Ptr("1"), + "memory": to.Ptr("4Gi"), "nvidia.com/gpu": nil, }, Requests: map[string]*string{ - "cpu": to.StringPtr("1"), - "memory": to.StringPtr("4Gi"), + "cpu": to.Ptr("1"), + "memory": to.Ptr("4Gi"), "nvidia.com/gpu": nil, }, }, }, }, - Namespace: to.StringPtr(""), + Namespace: to.Ptr(""), }, }, - Location: to.StringPtr(""), + Location: to.Ptr(""), }, - nil) + &armmachinelearningservices.ComputeClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.ComputeClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/patch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/patch.json func ExampleComputeClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewComputeClient("", cred, nil) + client, err := armmachinelearningservices.NewComputeClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginUpdate(ctx, "", "", @@ -130,154 +154,196 @@ func ExampleComputeClient_BeginUpdate() { Properties: &armmachinelearningservices.ClusterUpdateProperties{ Properties: &armmachinelearningservices.ScaleSettingsInformation{ ScaleSettings: &armmachinelearningservices.ScaleSettings{ - MaxNodeCount: to.Int32Ptr(4), - MinNodeCount: to.Int32Ptr(4), - NodeIdleTimeBeforeScaleDown: to.StringPtr(""), + MaxNodeCount: to.Ptr[int32](4), + MinNodeCount: to.Ptr[int32](4), + NodeIdleTimeBeforeScaleDown: to.Ptr(""), }, }, }, }, - nil) + &armmachinelearningservices.ComputeClientBeginUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.ComputeClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/delete.json func ExampleComputeClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewComputeClient("", cred, nil) + client, err := armmachinelearningservices.NewComputeClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "", "", "", - armmachinelearningservices.UnderlyingResourceAction("Delete"), - nil) + armmachinelearningservices.UnderlyingResourceActionDelete, + &armmachinelearningservices.ComputeClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/listNodes.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/listNodes.json func ExampleComputeClient_ListNodes() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewComputeClient("", cred, nil) + client, err := armmachinelearningservices.NewComputeClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListNodes("", "", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Nodes { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Nodes { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/listKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/listKeys.json func ExampleComputeClient_ListKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewComputeClient("", cred, nil) + client, err := armmachinelearningservices.NewComputeClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListKeys(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ComputeClientListKeysResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/start.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/start.json func ExampleComputeClient_BeginStart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewComputeClient("", cred, nil) + client, err := armmachinelearningservices.NewComputeClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginStart(ctx, "", "", "", - nil) + &armmachinelearningservices.ComputeClientBeginStartOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/stop.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/stop.json func ExampleComputeClient_BeginStop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewComputeClient("", cred, nil) + client, err := armmachinelearningservices.NewComputeClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginStop(ctx, "", "", "", - nil) + &armmachinelearningservices.ComputeClientBeginStopOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/restart.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Compute/restart.json func ExampleComputeClient_BeginRestart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewComputeClient("", cred, nil) + client, err := armmachinelearningservices.NewComputeClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginRestart(ctx, "", "", "", - nil) + &armmachinelearningservices.ComputeClientBeginRestartOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_privateendpointconnections_client_test.go index 47512a2ceef5..374f2d9738de 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_privateendpointconnections_client_test.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_privateendpointconnections_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,51 +17,74 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearningservices/armmachinelearningservices" ) -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/PrivateEndpointConnection/list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/PrivateEndpointConnection/list.json func ExamplePrivateEndpointConnectionsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewPrivateEndpointConnectionsClient("", cred, nil) - res, err := client.List(ctx, - "", + client, err := armmachinelearningservices.NewPrivateEndpointConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List("", "", nil) - if err != nil { - log.Fatal(err) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientListResult) } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/PrivateEndpointConnection/get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/PrivateEndpointConnection/get.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewPrivateEndpointConnectionsClient("", cred, nil) + client, err := armmachinelearningservices.NewPrivateEndpointConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/PrivateEndpointConnection/createOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/PrivateEndpointConnection/createOrUpdate.json func ExamplePrivateEndpointConnectionsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewPrivateEndpointConnectionsClient("", cred, nil) + client, err := armmachinelearningservices.NewPrivateEndpointConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", @@ -69,32 +92,40 @@ func ExamplePrivateEndpointConnectionsClient_CreateOrUpdate() { armmachinelearningservices.PrivateEndpointConnection{ Properties: &armmachinelearningservices.PrivateEndpointConnectionProperties{ PrivateLinkServiceConnectionState: &armmachinelearningservices.PrivateLinkServiceConnectionState{ - Description: to.StringPtr(""), - Status: armmachinelearningservices.PrivateEndpointServiceConnectionStatus("Approved").ToPtr(), + Description: to.Ptr(""), + Status: to.Ptr(armmachinelearningservices.PrivateEndpointServiceConnectionStatusApproved), }, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/PrivateEndpointConnection/delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/PrivateEndpointConnection/delete.json func ExamplePrivateEndpointConnectionsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewPrivateEndpointConnectionsClient("", cred, nil) + client, err := armmachinelearningservices.NewPrivateEndpointConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_privatelinkresources_client_test.go index 8295ce4e6f68..cc2b577187cf 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_privatelinkresources_client_test.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_privatelinkresources_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,20 +16,27 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearningservices/armmachinelearningservices" ) -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/PrivateLinkResource/list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/PrivateLinkResource/list.json func ExamplePrivateLinkResourcesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewPrivateLinkResourcesClient("", cred, nil) + client, err := armmachinelearningservices.NewPrivateLinkResourcesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateLinkResourcesClientListResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_quotas_client_test.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_quotas_client_test.go index 9c729dd27ed6..74adb8df495e 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_quotas_client_test.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_quotas_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,58 +17,69 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearningservices/armmachinelearningservices" ) -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Quota/update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Quota/update.json func ExampleQuotasClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewQuotasClient("", cred, nil) + client, err := armmachinelearningservices.NewQuotasClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", armmachinelearningservices.QuotaUpdateParameters{ Value: []*armmachinelearningservices.QuotaBaseProperties{ { - Type: to.StringPtr(""), - ID: to.StringPtr(""), - Limit: to.Int64Ptr(100), - Unit: armmachinelearningservices.QuotaUnit("Count").ToPtr(), + Type: to.Ptr(""), + ID: to.Ptr(""), + Limit: to.Ptr[int64](100), + Unit: to.Ptr(armmachinelearningservices.QuotaUnitCount), }, { - Type: to.StringPtr(""), - ID: to.StringPtr(""), - Limit: to.Int64Ptr(200), - Unit: armmachinelearningservices.QuotaUnit("Count").ToPtr(), + Type: to.Ptr(""), + ID: to.Ptr(""), + Limit: to.Ptr[int64](200), + Unit: to.Ptr(armmachinelearningservices.QuotaUnitCount), }}, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.QuotasClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Quota/list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Quota/list.json func ExampleQuotasClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewQuotasClient("", cred, nil) + client, err := armmachinelearningservices.NewQuotasClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_usages_client_test.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_usages_client_test.go index 34518e9a7391..25cc772c2ee3 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_usages_client_test.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_usages_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,26 +16,30 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearningservices/armmachinelearningservices" ) -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Usage/list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Usage/list.json func ExampleUsagesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewUsagesClient("", cred, nil) + client, err := armmachinelearningservices.NewUsagesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_virtualmachinesizes_client_test.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_virtualmachinesizes_client_test.go index b0b58d0c6b84..3101bf471ca4 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_virtualmachinesizes_client_test.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_virtualmachinesizes_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,19 +16,26 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearningservices/armmachinelearningservices" ) -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/VirtualMachineSize/list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/VirtualMachineSize/list.json func ExampleVirtualMachineSizesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewVirtualMachineSizesClient("", cred, nil) + client, err := armmachinelearningservices.NewVirtualMachineSizesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VirtualMachineSizesClientListResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspaceconnections_client_test.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspaceconnections_client_test.go index dbaa57d80c0c..ebd20563f672 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspaceconnections_client_test.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspaceconnections_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,86 +17,117 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearningservices/armmachinelearningservices" ) -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/WorkspaceConnection/list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/WorkspaceConnection/list.json func ExampleWorkspaceConnectionsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspaceConnectionsClient("", cred, nil) - res, err := client.List(ctx, - "", + client, err := armmachinelearningservices.NewWorkspaceConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List("", "", - &armmachinelearningservices.WorkspaceConnectionsClientListOptions{Target: to.StringPtr(""), - Category: to.StringPtr(""), + &armmachinelearningservices.WorkspaceConnectionsClientListOptions{Target: to.Ptr(""), + Category: to.Ptr(""), }) - if err != nil { - log.Fatal(err) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.WorkspaceConnectionsClientListResult) } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/WorkspaceConnection/create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/WorkspaceConnection/create.json func ExampleWorkspaceConnectionsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspaceConnectionsClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspaceConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Create(ctx, "", "", "", armmachinelearningservices.WorkspaceConnection{ Properties: &armmachinelearningservices.WorkspaceConnectionProps{ - AuthType: to.StringPtr(""), - Category: to.StringPtr(""), - Target: to.StringPtr(""), - Value: to.StringPtr(""), + AuthType: to.Ptr(""), + Category: to.Ptr(""), + Target: to.Ptr(""), + Value: to.Ptr(""), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.WorkspaceConnectionsClientCreateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/WorkspaceConnection/get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/WorkspaceConnection/get.json func ExampleWorkspaceConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspaceConnectionsClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspaceConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.WorkspaceConnectionsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/WorkspaceConnection/delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/WorkspaceConnection/delete.json func ExampleWorkspaceConnectionsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspaceConnectionsClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspaceConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspacefeatures_client_test.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspacefeatures_client_test.go index 36f208278406..1c623d1a5be2 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspacefeatures_client_test.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspacefeatures_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,27 +16,31 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearningservices/armmachinelearningservices" ) -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/WorkspaceFeature/list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/WorkspaceFeature/list.json func ExampleWorkspaceFeaturesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspaceFeaturesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspaceFeaturesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspaces_client_test.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspaces_client_test.go index 28e9c2e0ed56..c34ee2dfcba8 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspaces_client_test.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspaces_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,342 +19,438 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearningservices/armmachinelearningservices" ) -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/get.json func ExampleWorkspacesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.WorkspacesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/create.json func ExampleWorkspacesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "", "", armmachinelearningservices.Workspace{ Identity: &armmachinelearningservices.Identity{ - Type: armmachinelearningservices.ResourceIdentityTypeSystemAssignedUserAssigned.ToPtr(), + Type: to.Ptr(armmachinelearningservices.ResourceIdentityTypeSystemAssignedUserAssigned), UserAssignedIdentities: map[string]*armmachinelearningservices.UserAssignedIdentity{ "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspace-1234/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testuai": {}, }, }, - Location: to.StringPtr(""), + Location: to.Ptr(""), Properties: &armmachinelearningservices.WorkspaceProperties{ - Description: to.StringPtr(""), - ApplicationInsights: to.StringPtr(""), - ContainerRegistry: to.StringPtr(""), + Description: to.Ptr(""), + ApplicationInsights: to.Ptr(""), + ContainerRegistry: to.Ptr(""), Encryption: &armmachinelearningservices.EncryptionProperty{ Identity: &armmachinelearningservices.IdentityForCmk{ - UserAssignedIdentity: to.StringPtr(""), + UserAssignedIdentity: to.Ptr(""), }, KeyVaultProperties: &armmachinelearningservices.KeyVaultProperties{ - IdentityClientID: to.StringPtr(""), - KeyIdentifier: to.StringPtr(""), - KeyVaultArmID: to.StringPtr(""), + IdentityClientID: to.Ptr(""), + KeyIdentifier: to.Ptr(""), + KeyVaultArmID: to.Ptr(""), }, - Status: armmachinelearningservices.EncryptionStatus("Enabled").ToPtr(), + Status: to.Ptr(armmachinelearningservices.EncryptionStatusEnabled), }, - FriendlyName: to.StringPtr(""), - HbiWorkspace: to.BoolPtr(false), - KeyVault: to.StringPtr(""), + FriendlyName: to.Ptr(""), + HbiWorkspace: to.Ptr(false), + KeyVault: to.Ptr(""), SharedPrivateLinkResources: []*armmachinelearningservices.SharedPrivateLinkResource{ { - Name: to.StringPtr(""), + Name: to.Ptr(""), Properties: &armmachinelearningservices.SharedPrivateLinkResourceProperty{ - GroupID: to.StringPtr(""), - PrivateLinkResourceID: to.StringPtr(""), - RequestMessage: to.StringPtr(""), - Status: armmachinelearningservices.PrivateEndpointServiceConnectionStatus("Approved").ToPtr(), + GroupID: to.Ptr(""), + PrivateLinkResourceID: to.Ptr(""), + RequestMessage: to.Ptr(""), + Status: to.Ptr(armmachinelearningservices.PrivateEndpointServiceConnectionStatusApproved), }, }}, - StorageAccount: to.StringPtr(""), + StorageAccount: to.Ptr(""), }, }, - nil) + &armmachinelearningservices.WorkspacesClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.WorkspacesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/delete.json func ExampleWorkspacesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "", "", - nil) + &armmachinelearningservices.WorkspacesClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/update.json func ExampleWorkspacesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", armmachinelearningservices.WorkspaceUpdateParameters{ Properties: &armmachinelearningservices.WorkspacePropertiesUpdateParameters{ - Description: to.StringPtr(""), - FriendlyName: to.StringPtr(""), - PublicNetworkAccess: armmachinelearningservices.PublicNetworkAccess("Disabled").ToPtr(), + Description: to.Ptr(""), + FriendlyName: to.Ptr(""), + PublicNetworkAccess: to.Ptr(armmachinelearningservices.PublicNetworkAccessDisabled), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.WorkspacesClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/listByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/listByResourceGroup.json func ExampleWorkspacesClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByResourceGroup("", &armmachinelearningservices.WorkspacesClientListByResourceGroupOptions{Skip: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/diagnose.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/diagnose.json func ExampleWorkspacesClient_BeginDiagnose() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDiagnose(ctx, "", "", &armmachinelearningservices.WorkspacesClientBeginDiagnoseOptions{Parameters: &armmachinelearningservices.DiagnoseWorkspaceParameters{ Value: &armmachinelearningservices.DiagnoseRequestProperties{ - ApplicationInsights: map[string]map[string]interface{}{}, - ContainerRegistry: map[string]map[string]interface{}{}, - DNSResolution: map[string]map[string]interface{}{}, - KeyVault: map[string]map[string]interface{}{}, - Nsg: map[string]map[string]interface{}{}, - Others: map[string]map[string]interface{}{}, - ResourceLock: map[string]map[string]interface{}{}, - StorageAccount: map[string]map[string]interface{}{}, - Udr: map[string]map[string]interface{}{}, + ApplicationInsights: map[string]interface{}{}, + ContainerRegistry: map[string]interface{}{}, + DNSResolution: map[string]interface{}{}, + KeyVault: map[string]interface{}{}, + Nsg: map[string]interface{}{}, + Others: map[string]interface{}{}, + ResourceLock: map[string]interface{}{}, + StorageAccount: map[string]interface{}{}, + Udr: map[string]interface{}{}, }, }, + ResumeToken: "", }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.WorkspacesClientDiagnoseResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/listKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/listKeys.json func ExampleWorkspacesClient_ListKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListKeys(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.WorkspacesClientListKeysResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/resyncKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/resyncKeys.json func ExampleWorkspacesClient_BeginResyncKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginResyncKeys(ctx, "", "", - nil) + &armmachinelearningservices.WorkspacesClientBeginResyncKeysOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/listBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/listBySubscription.json func ExampleWorkspacesClient_ListBySubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListBySubscription(&armmachinelearningservices.WorkspacesClientListBySubscriptionOptions{Skip: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/listNotebookAccessToken.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/listNotebookAccessToken.json func ExampleWorkspacesClient_ListNotebookAccessToken() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListNotebookAccessToken(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.WorkspacesClientListNotebookAccessTokenResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Notebook/prepare.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Notebook/prepare.json func ExampleWorkspacesClient_BeginPrepareNotebook() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginPrepareNotebook(ctx, "", "", - nil) + &armmachinelearningservices.WorkspacesClientBeginPrepareNotebookOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.WorkspacesClientPrepareNotebookResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/listStorageAccountKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Workspace/listStorageAccountKeys.json func ExampleWorkspacesClient_ListStorageAccountKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListStorageAccountKeys(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.WorkspacesClientListStorageAccountKeysResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Notebook/listKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/Notebook/listKeys.json func ExampleWorkspacesClient_ListNotebookKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListNotebookKeys(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.WorkspacesClientListNotebookKeysResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/ExternalFQDN/get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/ExternalFQDN/get.json func ExampleWorkspacesClient_ListOutboundNetworkDependenciesEndpoints() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspacesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListOutboundNetworkDependenciesEndpoints(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.WorkspacesClientListOutboundNetworkDependenciesEndpointsResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspaceskus_client_test.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspaceskus_client_test.go index d0bc92f1d710..3a038ab3f7f4 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspaceskus_client_test.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/ze_generated_example_workspaceskus_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,25 +16,29 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearningservices/armmachinelearningservices" ) -// x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/WorkspaceSku/list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-07-01/examples/WorkspaceSku/list.json func ExampleWorkspaceSKUsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmachinelearningservices.NewWorkspaceSKUsClient("", cred, nil) + client, err := armmachinelearningservices.NewWorkspaceSKUsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_compute_client.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_compute_client.go index e944784d6610..d60b655648db 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_compute_client.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_compute_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ComputeClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewComputeClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ComputeClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewComputeClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ComputeClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ComputeClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Creates or updates compute. This call will overwrite a compute if it exists. This is a nonrecoverable @@ -59,22 +64,16 @@ func NewComputeClient(subscriptionID string, credential azcore.TokenCredential, // parameters - Payload with Machine Learning compute definition. // options - ComputeClientBeginCreateOrUpdateOptions contains the optional parameters for the ComputeClient.BeginCreateOrUpdate // method. -func (client *ComputeClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, parameters ComputeResource, options *ComputeClientBeginCreateOrUpdateOptions) (ComputeClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, workspaceName, computeName, parameters, options) - if err != nil { - return ComputeClientCreateOrUpdatePollerResponse{}, err - } - result := ComputeClientCreateOrUpdatePollerResponse{ - RawResponse: resp, +func (client *ComputeClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, parameters ComputeResource, options *ComputeClientBeginCreateOrUpdateOptions) (*armruntime.Poller[ComputeClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, workspaceName, computeName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ComputeClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ComputeClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("ComputeClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return ComputeClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &ComputeClientCreateOrUpdatePoller{ - pt: pt, - } - return result, nil } // CreateOrUpdate - Creates or updates compute. This call will overwrite a compute if it exists. This is a nonrecoverable @@ -134,22 +133,16 @@ func (client *ComputeClient) createOrUpdateCreateRequest(ctx context.Context, re // underlyingResourceAction - Delete the underlying compute if 'Delete', or detach the underlying compute from workspace if // 'Detach'. // options - ComputeClientBeginDeleteOptions contains the optional parameters for the ComputeClient.BeginDelete method. -func (client *ComputeClient) BeginDelete(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, underlyingResourceAction UnderlyingResourceAction, options *ComputeClientBeginDeleteOptions) (ComputeClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, workspaceName, computeName, underlyingResourceAction, options) - if err != nil { - return ComputeClientDeletePollerResponse{}, err - } - result := ComputeClientDeletePollerResponse{ - RawResponse: resp, +func (client *ComputeClient) BeginDelete(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, underlyingResourceAction UnderlyingResourceAction, options *ComputeClientBeginDeleteOptions) (*armruntime.Poller[ComputeClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, workspaceName, computeName, underlyingResourceAction, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ComputeClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ComputeClientDeleteResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("ComputeClient.Delete", "", resp, client.pl) - if err != nil { - return ComputeClientDeletePollerResponse{}, err - } - result.Poller = &ComputeClientDeletePoller{ - pt: pt, - } - return result, nil } // Delete - Deletes specified Machine Learning compute. @@ -254,7 +247,7 @@ func (client *ComputeClient) getCreateRequest(ctx context.Context, resourceGroup // getHandleResponse handles the Get response. func (client *ComputeClient) getHandleResponse(resp *http.Response) (ComputeClientGetResponse, error) { - result := ComputeClientGetResponse{RawResponse: resp} + result := ComputeClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ComputeResource); err != nil { return ComputeClientGetResponse{}, err } @@ -266,16 +259,32 @@ func (client *ComputeClient) getHandleResponse(resp *http.Response) (ComputeClie // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - Name of Azure Machine Learning workspace. // options - ComputeClientListOptions contains the optional parameters for the ComputeClient.List method. -func (client *ComputeClient) List(resourceGroupName string, workspaceName string, options *ComputeClientListOptions) *ComputeClientListPager { - return &ComputeClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) +func (client *ComputeClient) List(resourceGroupName string, workspaceName string, options *ComputeClientListOptions) *runtime.Pager[ComputeClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ComputeClientListResponse]{ + More: func(page ComputeClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ComputeClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PaginatedComputeResourcesList.NextLink) + Fetcher: func(ctx context.Context, page *ComputeClientListResponse) (ComputeClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ComputeClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ComputeClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ComputeClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -309,7 +318,7 @@ func (client *ComputeClient) listCreateRequest(ctx context.Context, resourceGrou // listHandleResponse handles the List response. func (client *ComputeClient) listHandleResponse(resp *http.Response) (ComputeClientListResponse, error) { - result := ComputeClientListResponse{RawResponse: resp} + result := ComputeClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PaginatedComputeResourcesList); err != nil { return ComputeClientListResponse{}, err } @@ -369,7 +378,7 @@ func (client *ComputeClient) listKeysCreateRequest(ctx context.Context, resource // listKeysHandleResponse handles the ListKeys response. func (client *ComputeClient) listKeysHandleResponse(resp *http.Response) (ComputeClientListKeysResponse, error) { - result := ComputeClientListKeysResponse{RawResponse: resp} + result := ComputeClientListKeysResponse{} if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { return ComputeClientListKeysResponse{}, err } @@ -382,16 +391,32 @@ func (client *ComputeClient) listKeysHandleResponse(resp *http.Response) (Comput // workspaceName - Name of Azure Machine Learning workspace. // computeName - Name of the Azure Machine Learning compute. // options - ComputeClientListNodesOptions contains the optional parameters for the ComputeClient.ListNodes method. -func (client *ComputeClient) ListNodes(resourceGroupName string, workspaceName string, computeName string, options *ComputeClientListNodesOptions) *ComputeClientListNodesPager { - return &ComputeClientListNodesPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listNodesCreateRequest(ctx, resourceGroupName, workspaceName, computeName, options) +func (client *ComputeClient) ListNodes(resourceGroupName string, workspaceName string, computeName string, options *ComputeClientListNodesOptions) *runtime.Pager[ComputeClientListNodesResponse] { + return runtime.NewPager(runtime.PageProcessor[ComputeClientListNodesResponse]{ + More: func(page ComputeClientListNodesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ComputeClientListNodesResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.AmlComputeNodesInformation.NextLink) + Fetcher: func(ctx context.Context, page *ComputeClientListNodesResponse) (ComputeClientListNodesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listNodesCreateRequest(ctx, resourceGroupName, workspaceName, computeName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ComputeClientListNodesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ComputeClientListNodesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ComputeClientListNodesResponse{}, runtime.NewResponseError(resp) + } + return client.listNodesHandleResponse(resp) }, - } + }) } // listNodesCreateRequest creates the ListNodes request. @@ -426,7 +451,7 @@ func (client *ComputeClient) listNodesCreateRequest(ctx context.Context, resourc // listNodesHandleResponse handles the ListNodes response. func (client *ComputeClient) listNodesHandleResponse(resp *http.Response) (ComputeClientListNodesResponse, error) { - result := ComputeClientListNodesResponse{RawResponse: resp} + result := ComputeClientListNodesResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AmlComputeNodesInformation); err != nil { return ComputeClientListNodesResponse{}, err } @@ -439,22 +464,16 @@ func (client *ComputeClient) listNodesHandleResponse(resp *http.Response) (Compu // workspaceName - Name of Azure Machine Learning workspace. // computeName - Name of the Azure Machine Learning compute. // options - ComputeClientBeginRestartOptions contains the optional parameters for the ComputeClient.BeginRestart method. -func (client *ComputeClient) BeginRestart(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, options *ComputeClientBeginRestartOptions) (ComputeClientRestartPollerResponse, error) { - resp, err := client.restart(ctx, resourceGroupName, workspaceName, computeName, options) - if err != nil { - return ComputeClientRestartPollerResponse{}, err - } - result := ComputeClientRestartPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("ComputeClient.Restart", "", resp, client.pl) - if err != nil { - return ComputeClientRestartPollerResponse{}, err +func (client *ComputeClient) BeginRestart(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, options *ComputeClientBeginRestartOptions) (*armruntime.Poller[ComputeClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, workspaceName, computeName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ComputeClientRestartResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ComputeClientRestartResponse](options.ResumeToken, client.pl, nil) } - result.Poller = &ComputeClientRestartPoller{ - pt: pt, - } - return result, nil } // Restart - Posts a restart action to a compute instance @@ -510,22 +529,16 @@ func (client *ComputeClient) restartCreateRequest(ctx context.Context, resourceG // workspaceName - Name of Azure Machine Learning workspace. // computeName - Name of the Azure Machine Learning compute. // options - ComputeClientBeginStartOptions contains the optional parameters for the ComputeClient.BeginStart method. -func (client *ComputeClient) BeginStart(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, options *ComputeClientBeginStartOptions) (ComputeClientStartPollerResponse, error) { - resp, err := client.start(ctx, resourceGroupName, workspaceName, computeName, options) - if err != nil { - return ComputeClientStartPollerResponse{}, err - } - result := ComputeClientStartPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("ComputeClient.Start", "", resp, client.pl) - if err != nil { - return ComputeClientStartPollerResponse{}, err - } - result.Poller = &ComputeClientStartPoller{ - pt: pt, +func (client *ComputeClient) BeginStart(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, options *ComputeClientBeginStartOptions) (*armruntime.Poller[ComputeClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, workspaceName, computeName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ComputeClientStartResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ComputeClientStartResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Start - Posts a start action to a compute instance @@ -581,22 +594,16 @@ func (client *ComputeClient) startCreateRequest(ctx context.Context, resourceGro // workspaceName - Name of Azure Machine Learning workspace. // computeName - Name of the Azure Machine Learning compute. // options - ComputeClientBeginStopOptions contains the optional parameters for the ComputeClient.BeginStop method. -func (client *ComputeClient) BeginStop(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, options *ComputeClientBeginStopOptions) (ComputeClientStopPollerResponse, error) { - resp, err := client.stop(ctx, resourceGroupName, workspaceName, computeName, options) - if err != nil { - return ComputeClientStopPollerResponse{}, err - } - result := ComputeClientStopPollerResponse{ - RawResponse: resp, +func (client *ComputeClient) BeginStop(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, options *ComputeClientBeginStopOptions) (*armruntime.Poller[ComputeClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, workspaceName, computeName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ComputeClientStopResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ComputeClientStopResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("ComputeClient.Stop", "", resp, client.pl) - if err != nil { - return ComputeClientStopPollerResponse{}, err - } - result.Poller = &ComputeClientStopPoller{ - pt: pt, - } - return result, nil } // Stop - Posts a stop action to a compute instance @@ -654,22 +661,16 @@ func (client *ComputeClient) stopCreateRequest(ctx context.Context, resourceGrou // computeName - Name of the Azure Machine Learning compute. // parameters - Additional parameters for cluster update. // options - ComputeClientBeginUpdateOptions contains the optional parameters for the ComputeClient.BeginUpdate method. -func (client *ComputeClient) BeginUpdate(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, parameters ClusterUpdateParameters, options *ComputeClientBeginUpdateOptions) (ComputeClientUpdatePollerResponse, error) { - resp, err := client.update(ctx, resourceGroupName, workspaceName, computeName, parameters, options) - if err != nil { - return ComputeClientUpdatePollerResponse{}, err +func (client *ComputeClient) BeginUpdate(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, parameters ClusterUpdateParameters, options *ComputeClientBeginUpdateOptions) (*armruntime.Poller[ComputeClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, workspaceName, computeName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ComputeClientUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ComputeClientUpdateResponse](options.ResumeToken, client.pl, nil) } - result := ComputeClientUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("ComputeClient.Update", "", resp, client.pl) - if err != nil { - return ComputeClientUpdatePollerResponse{}, err - } - result.Poller = &ComputeClientUpdatePoller{ - pt: pt, - } - return result, nil } // Update - Updates properties of a compute. This call will overwrite a compute if it exists. This is a nonrecoverable operation. diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_constants.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_constants.go index acf044e6247f..1dbcae869b87 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_constants.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armmachinelearningservices const ( moduleName = "armmachinelearningservices" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // AllocationState - Allocation state of the compute. Possible values are: steady - Indicates that the compute is not resizing. @@ -33,11 +33,6 @@ func PossibleAllocationStateValues() []AllocationState { } } -// ToPtr returns a *AllocationState pointing to the current value. -func (c AllocationState) ToPtr() *AllocationState { - return &c -} - // ApplicationSharingPolicy - Policy for sharing applications on this compute instance among users of parent workspace. If // Personal, only the creator can access applications on this compute instance. When Shared, any workspace // user can access applications on this instance depending on his/her assigned role. @@ -56,11 +51,6 @@ func PossibleApplicationSharingPolicyValues() []ApplicationSharingPolicy { } } -// ToPtr returns a *ApplicationSharingPolicy pointing to the current value. -func (c ApplicationSharingPolicy) ToPtr() *ApplicationSharingPolicy { - return &c -} - // BillingCurrency - Three lettered code specifying the currency of the VM price. Example: USD type BillingCurrency string @@ -75,11 +65,6 @@ func PossibleBillingCurrencyValues() []BillingCurrency { } } -// ToPtr returns a *BillingCurrency pointing to the current value. -func (c BillingCurrency) ToPtr() *BillingCurrency { - return &c -} - // ClusterPurpose - Intended usage of the cluster type ClusterPurpose string @@ -98,11 +83,6 @@ func PossibleClusterPurposeValues() []ClusterPurpose { } } -// ToPtr returns a *ClusterPurpose pointing to the current value. -func (c ClusterPurpose) ToPtr() *ClusterPurpose { - return &c -} - // ComputeInstanceAuthorizationType - The Compute Instance Authorization type. Available values are personal (default). type ComputeInstanceAuthorizationType string @@ -117,11 +97,6 @@ func PossibleComputeInstanceAuthorizationTypeValues() []ComputeInstanceAuthoriza } } -// ToPtr returns a *ComputeInstanceAuthorizationType pointing to the current value. -func (c ComputeInstanceAuthorizationType) ToPtr() *ComputeInstanceAuthorizationType { - return &c -} - // ComputeInstanceState - Current state of an ComputeInstance. type ComputeInstanceState string @@ -164,11 +139,6 @@ func PossibleComputeInstanceStateValues() []ComputeInstanceState { } } -// ToPtr returns a *ComputeInstanceState pointing to the current value. -func (c ComputeInstanceState) ToPtr() *ComputeInstanceState { - return &c -} - // ComputeType - The type of compute type ComputeType string @@ -201,11 +171,6 @@ func PossibleComputeTypeValues() []ComputeType { } } -// ToPtr returns a *ComputeType pointing to the current value. -func (c ComputeType) ToPtr() *ComputeType { - return &c -} - // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -226,11 +191,6 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// ToPtr returns a *CreatedByType pointing to the current value. -func (c CreatedByType) ToPtr() *CreatedByType { - return &c -} - // DiagnoseResultLevel - Level of workspace setup error type DiagnoseResultLevel string @@ -249,11 +209,6 @@ func PossibleDiagnoseResultLevelValues() []DiagnoseResultLevel { } } -// ToPtr returns a *DiagnoseResultLevel pointing to the current value. -func (c DiagnoseResultLevel) ToPtr() *DiagnoseResultLevel { - return &c -} - // EncryptionStatus - Indicates whether or not the encryption is enabled for the workspace. type EncryptionStatus string @@ -270,11 +225,6 @@ func PossibleEncryptionStatusValues() []EncryptionStatus { } } -// ToPtr returns a *EncryptionStatus pointing to the current value. -func (c EncryptionStatus) ToPtr() *EncryptionStatus { - return &c -} - // LoadBalancerType - Load Balancer Type type LoadBalancerType string @@ -291,11 +241,6 @@ func PossibleLoadBalancerTypeValues() []LoadBalancerType { } } -// ToPtr returns a *LoadBalancerType pointing to the current value. -func (c LoadBalancerType) ToPtr() *LoadBalancerType { - return &c -} - // NodeState - State of the compute node. Values are idle, running, preparing, unusable, leaving and preempted. type NodeState string @@ -320,11 +265,6 @@ func PossibleNodeStateValues() []NodeState { } } -// ToPtr returns a *NodeState pointing to the current value. -func (c NodeState) ToPtr() *NodeState { - return &c -} - // OperationName - Name of the last operation. type OperationName string @@ -349,11 +289,6 @@ func PossibleOperationNameValues() []OperationName { } } -// ToPtr returns a *OperationName pointing to the current value. -func (c OperationName) ToPtr() *OperationName { - return &c -} - // OperationStatus - Operation status. type OperationStatus string @@ -382,11 +317,6 @@ func PossibleOperationStatusValues() []OperationStatus { } } -// ToPtr returns a *OperationStatus pointing to the current value. -func (c OperationStatus) ToPtr() *OperationStatus { - return &c -} - // OsType - Compute OS Type type OsType string @@ -403,11 +333,6 @@ func PossibleOsTypeValues() []OsType { } } -// ToPtr returns a *OsType pointing to the current value. -func (c OsType) ToPtr() *OsType { - return &c -} - // PrivateEndpointConnectionProvisioningState - The current provisioning state. type PrivateEndpointConnectionProvisioningState string @@ -428,11 +353,6 @@ func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpoin } } -// ToPtr returns a *PrivateEndpointConnectionProvisioningState pointing to the current value. -func (c PrivateEndpointConnectionProvisioningState) ToPtr() *PrivateEndpointConnectionProvisioningState { - return &c -} - // PrivateEndpointServiceConnectionStatus - The private endpoint connection status. type PrivateEndpointServiceConnectionStatus string @@ -455,11 +375,6 @@ func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointSer } } -// ToPtr returns a *PrivateEndpointServiceConnectionStatus pointing to the current value. -func (c PrivateEndpointServiceConnectionStatus) ToPtr() *PrivateEndpointServiceConnectionStatus { - return &c -} - // ProvisioningState - The current deployment state of workspace resource. The provisioningState is to indicate states for // resource provisioning. type ProvisioningState string @@ -487,11 +402,6 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// ToPtr returns a *ProvisioningState pointing to the current value. -func (c ProvisioningState) ToPtr() *ProvisioningState { - return &c -} - // PublicNetworkAccess - Whether requests from Public Network are allowed. type PublicNetworkAccess string @@ -508,11 +418,6 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { } } -// ToPtr returns a *PublicNetworkAccess pointing to the current value. -func (c PublicNetworkAccess) ToPtr() *PublicNetworkAccess { - return &c -} - // QuotaUnit - An enum describing the unit of quota measurement. type QuotaUnit string @@ -527,11 +432,6 @@ func PossibleQuotaUnitValues() []QuotaUnit { } } -// ToPtr returns a *QuotaUnit pointing to the current value. -func (c QuotaUnit) ToPtr() *QuotaUnit { - return &c -} - // ReasonCode - The reason for the restriction. type ReasonCode string @@ -550,11 +450,6 @@ func PossibleReasonCodeValues() []ReasonCode { } } -// ToPtr returns a *ReasonCode pointing to the current value. -func (c ReasonCode) ToPtr() *ReasonCode { - return &c -} - // RemoteLoginPortPublicAccess - State of the public SSH port. Possible values are: Disabled - Indicates that the public ssh // port is closed on all nodes of the cluster. Enabled - Indicates that the public ssh port is open on all // nodes of the cluster. NotSpecified - Indicates that the public ssh port is closed on all nodes of the cluster if VNet is @@ -577,11 +472,6 @@ func PossibleRemoteLoginPortPublicAccessValues() []RemoteLoginPortPublicAccess { } } -// ToPtr returns a *RemoteLoginPortPublicAccess pointing to the current value. -func (c RemoteLoginPortPublicAccess) ToPtr() *RemoteLoginPortPublicAccess { - return &c -} - // ResourceIdentityType - The identity type. type ResourceIdentityType string @@ -602,11 +492,6 @@ func PossibleResourceIdentityTypeValues() []ResourceIdentityType { } } -// ToPtr returns a *ResourceIdentityType pointing to the current value. -func (c ResourceIdentityType) ToPtr() *ResourceIdentityType { - return &c -} - // SSHPublicAccess - State of the public SSH port. Possible values are: Disabled - Indicates that the public ssh port is closed // on this instance. Enabled - Indicates that the public ssh port is open and accessible // according to the VNet/subnet policy if applicable. @@ -625,11 +510,6 @@ func PossibleSSHPublicAccessValues() []SSHPublicAccess { } } -// ToPtr returns a *SSHPublicAccess pointing to the current value. -func (c SSHPublicAccess) ToPtr() *SSHPublicAccess { - return &c -} - // SSLConfigurationStatus - Enable or disable ssl for scoring type SSLConfigurationStatus string @@ -648,11 +528,6 @@ func PossibleSSLConfigurationStatusValues() []SSLConfigurationStatus { } } -// ToPtr returns a *SSLConfigurationStatus pointing to the current value. -func (c SSLConfigurationStatus) ToPtr() *SSLConfigurationStatus { - return &c -} - // Status - Status of update workspace quota. type Status string @@ -681,11 +556,6 @@ func PossibleStatusValues() []Status { } } -// ToPtr returns a *Status pointing to the current value. -func (c Status) ToPtr() *Status { - return &c -} - type UnderlyingResourceAction string const ( @@ -701,11 +571,6 @@ func PossibleUnderlyingResourceActionValues() []UnderlyingResourceAction { } } -// ToPtr returns a *UnderlyingResourceAction pointing to the current value. -func (c UnderlyingResourceAction) ToPtr() *UnderlyingResourceAction { - return &c -} - // UnitOfMeasure - The unit of time measurement for the specified VM price. Example: OneHour type UnitOfMeasure string @@ -720,11 +585,6 @@ func PossibleUnitOfMeasureValues() []UnitOfMeasure { } } -// ToPtr returns a *UnitOfMeasure pointing to the current value. -func (c UnitOfMeasure) ToPtr() *UnitOfMeasure { - return &c -} - // UsageUnit - An enum describing the unit of usage measurement. type UsageUnit string @@ -739,11 +599,6 @@ func PossibleUsageUnitValues() []UsageUnit { } } -// ToPtr returns a *UsageUnit pointing to the current value. -func (c UsageUnit) ToPtr() *UsageUnit { - return &c -} - // VMPriceOSType - Operating system type used by the VM. type VMPriceOSType string @@ -760,11 +615,6 @@ func PossibleVMPriceOSTypeValues() []VMPriceOSType { } } -// ToPtr returns a *VMPriceOSType pointing to the current value. -func (c VMPriceOSType) ToPtr() *VMPriceOSType { - return &c -} - // VMPriority - Virtual Machine priority type VMPriority string @@ -781,11 +631,6 @@ func PossibleVMPriorityValues() []VMPriority { } } -// ToPtr returns a *VMPriority pointing to the current value. -func (c VMPriority) ToPtr() *VMPriority { - return &c -} - // VMTier - The type of the VM. type VMTier string @@ -804,11 +649,6 @@ func PossibleVMTierValues() []VMTier { } } -// ToPtr returns a *VMTier pointing to the current value. -func (c VMTier) ToPtr() *VMTier { - return &c -} - // ValueFormat - format for the workspace connection value type ValueFormat string @@ -822,8 +662,3 @@ func PossibleValueFormatValues() []ValueFormat { ValueFormatJSON, } } - -// ToPtr returns a *ValueFormat pointing to the current value. -func (c ValueFormat) ToPtr() *ValueFormat { - return &c -} diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_models.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_models.go index f6ecb1a7290e..aa6b97036415 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_models.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armmachinelearningservices -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // AKS - A Machine Learning compute based on AKS. type AKS struct { @@ -52,89 +47,6 @@ type AKS struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// GetCompute implements the ComputeClassification interface for type AKS. -func (a *AKS) GetCompute() *Compute { - return &Compute{ - ComputeType: a.ComputeType, - ComputeLocation: a.ComputeLocation, - ProvisioningState: a.ProvisioningState, - Description: a.Description, - CreatedOn: a.CreatedOn, - ModifiedOn: a.ModifiedOn, - ResourceID: a.ResourceID, - ProvisioningErrors: a.ProvisioningErrors, - IsAttachedCompute: a.IsAttachedCompute, - DisableLocalAuth: a.DisableLocalAuth, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AKS. -func (a AKS) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "computeLocation", a.ComputeLocation) - objectMap["computeType"] = ComputeTypeAKS - populateTimeRFC3339(objectMap, "createdOn", a.CreatedOn) - populate(objectMap, "description", a.Description) - populate(objectMap, "disableLocalAuth", a.DisableLocalAuth) - populate(objectMap, "isAttachedCompute", a.IsAttachedCompute) - populateTimeRFC3339(objectMap, "modifiedOn", a.ModifiedOn) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "provisioningErrors", a.ProvisioningErrors) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "resourceId", a.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AKS. -func (a *AKS) 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 "computeLocation": - err = unpopulate(val, &a.ComputeLocation) - delete(rawMsg, key) - case "computeType": - err = unpopulate(val, &a.ComputeType) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, &a.CreatedOn) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &a.Description) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, &a.DisableLocalAuth) - delete(rawMsg, key) - case "isAttachedCompute": - err = unpopulate(val, &a.IsAttachedCompute) - delete(rawMsg, key) - case "modifiedOn": - err = unpopulateTimeRFC3339(val, &a.ModifiedOn) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, &a.Properties) - delete(rawMsg, key) - case "provisioningErrors": - err = unpopulate(val, &a.ProvisioningErrors) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &a.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, &a.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AKSProperties - AKS properties type AKSProperties struct { // Number of agents @@ -165,21 +77,6 @@ type AKSProperties struct { SystemServices []*SystemService `json:"systemServices,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AKSProperties. -func (a AKSProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "agentCount", a.AgentCount) - populate(objectMap, "agentVmSize", a.AgentVMSize) - populate(objectMap, "aksNetworkingConfiguration", a.AksNetworkingConfiguration) - populate(objectMap, "clusterFqdn", a.ClusterFqdn) - populate(objectMap, "clusterPurpose", a.ClusterPurpose) - populate(objectMap, "loadBalancerSubnet", a.LoadBalancerSubnet) - populate(objectMap, "loadBalancerType", a.LoadBalancerType) - populate(objectMap, "sslConfiguration", a.SSLConfiguration) - populate(objectMap, "systemServices", a.SystemServices) - return json.Marshal(objectMap) -} - // AksComputeSecrets - Secrets related to a Machine Learning compute based on AKS. type AksComputeSecrets struct { // REQUIRED; The type of compute @@ -195,52 +92,6 @@ type AksComputeSecrets struct { UserKubeConfig *string `json:"userKubeConfig,omitempty"` } -// GetComputeSecrets implements the ComputeSecretsClassification interface for type AksComputeSecrets. -func (a *AksComputeSecrets) GetComputeSecrets() *ComputeSecrets { - return &ComputeSecrets{ - ComputeType: a.ComputeType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AksComputeSecrets. -func (a AksComputeSecrets) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "adminKubeConfig", a.AdminKubeConfig) - objectMap["computeType"] = ComputeTypeAKS - populate(objectMap, "imagePullSecretName", a.ImagePullSecretName) - populate(objectMap, "userKubeConfig", a.UserKubeConfig) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AksComputeSecrets. -func (a *AksComputeSecrets) 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 "adminKubeConfig": - err = unpopulate(val, &a.AdminKubeConfig) - delete(rawMsg, key) - case "computeType": - err = unpopulate(val, &a.ComputeType) - delete(rawMsg, key) - case "imagePullSecretName": - err = unpopulate(val, &a.ImagePullSecretName) - delete(rawMsg, key) - case "userKubeConfig": - err = unpopulate(val, &a.UserKubeConfig) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AksComputeSecretsProperties - Properties of AksComputeSecrets type AksComputeSecretsProperties struct { // Content of kubeconfig file that can be used to connect to the Kubernetes cluster. @@ -307,89 +158,6 @@ type AmlCompute struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// GetCompute implements the ComputeClassification interface for type AmlCompute. -func (a *AmlCompute) GetCompute() *Compute { - return &Compute{ - ComputeType: a.ComputeType, - ComputeLocation: a.ComputeLocation, - ProvisioningState: a.ProvisioningState, - Description: a.Description, - CreatedOn: a.CreatedOn, - ModifiedOn: a.ModifiedOn, - ResourceID: a.ResourceID, - ProvisioningErrors: a.ProvisioningErrors, - IsAttachedCompute: a.IsAttachedCompute, - DisableLocalAuth: a.DisableLocalAuth, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AmlCompute. -func (a AmlCompute) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "computeLocation", a.ComputeLocation) - objectMap["computeType"] = ComputeTypeAmlCompute - populateTimeRFC3339(objectMap, "createdOn", a.CreatedOn) - populate(objectMap, "description", a.Description) - populate(objectMap, "disableLocalAuth", a.DisableLocalAuth) - populate(objectMap, "isAttachedCompute", a.IsAttachedCompute) - populateTimeRFC3339(objectMap, "modifiedOn", a.ModifiedOn) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "provisioningErrors", a.ProvisioningErrors) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "resourceId", a.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AmlCompute. -func (a *AmlCompute) 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 "computeLocation": - err = unpopulate(val, &a.ComputeLocation) - delete(rawMsg, key) - case "computeType": - err = unpopulate(val, &a.ComputeType) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, &a.CreatedOn) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &a.Description) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, &a.DisableLocalAuth) - delete(rawMsg, key) - case "isAttachedCompute": - err = unpopulate(val, &a.IsAttachedCompute) - delete(rawMsg, key) - case "modifiedOn": - err = unpopulateTimeRFC3339(val, &a.ModifiedOn) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, &a.Properties) - delete(rawMsg, key) - case "provisioningErrors": - err = unpopulate(val, &a.ProvisioningErrors) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &a.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, &a.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AmlComputeNodeInformation - Compute node information related to a AmlCompute. type AmlComputeNodeInformation struct { // READ-ONLY; ID of the compute node. @@ -420,14 +188,6 @@ type AmlComputeNodesInformation struct { Nodes []*AmlComputeNodeInformation `json:"nodes,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AmlComputeNodesInformation. -func (a AmlComputeNodesInformation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "nodes", a.Nodes) - return json.Marshal(objectMap) -} - // AmlComputeProperties - AML Compute properties type AmlComputeProperties struct { // Enable or disable node public IP address provisioning. Possible values are: Possible values are: true - Indicates that @@ -491,93 +251,6 @@ type AmlComputeProperties struct { TargetNodeCount *int32 `json:"targetNodeCount,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AmlComputeProperties. -func (a AmlComputeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allocationState", a.AllocationState) - populateTimeRFC3339(objectMap, "allocationStateTransitionTime", a.AllocationStateTransitionTime) - populate(objectMap, "currentNodeCount", a.CurrentNodeCount) - populate(objectMap, "enableNodePublicIp", a.EnableNodePublicIP) - populate(objectMap, "errors", a.Errors) - populate(objectMap, "isolatedNetwork", a.IsolatedNetwork) - populate(objectMap, "nodeStateCounts", a.NodeStateCounts) - populate(objectMap, "osType", a.OSType) - populate(objectMap, "remoteLoginPortPublicAccess", a.RemoteLoginPortPublicAccess) - populate(objectMap, "scaleSettings", a.ScaleSettings) - populate(objectMap, "subnet", a.Subnet) - populate(objectMap, "targetNodeCount", a.TargetNodeCount) - populate(objectMap, "userAccountCredentials", a.UserAccountCredentials) - populate(objectMap, "vmPriority", a.VMPriority) - populate(objectMap, "vmSize", a.VMSize) - populate(objectMap, "virtualMachineImage", a.VirtualMachineImage) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AmlComputeProperties. -func (a *AmlComputeProperties) 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 "allocationState": - err = unpopulate(val, &a.AllocationState) - delete(rawMsg, key) - case "allocationStateTransitionTime": - err = unpopulateTimeRFC3339(val, &a.AllocationStateTransitionTime) - delete(rawMsg, key) - case "currentNodeCount": - err = unpopulate(val, &a.CurrentNodeCount) - delete(rawMsg, key) - case "enableNodePublicIp": - err = unpopulate(val, &a.EnableNodePublicIP) - delete(rawMsg, key) - case "errors": - err = unpopulate(val, &a.Errors) - delete(rawMsg, key) - case "isolatedNetwork": - err = unpopulate(val, &a.IsolatedNetwork) - delete(rawMsg, key) - case "nodeStateCounts": - err = unpopulate(val, &a.NodeStateCounts) - delete(rawMsg, key) - case "osType": - err = unpopulate(val, &a.OSType) - delete(rawMsg, key) - case "remoteLoginPortPublicAccess": - err = unpopulate(val, &a.RemoteLoginPortPublicAccess) - delete(rawMsg, key) - case "scaleSettings": - err = unpopulate(val, &a.ScaleSettings) - delete(rawMsg, key) - case "subnet": - err = unpopulate(val, &a.Subnet) - delete(rawMsg, key) - case "targetNodeCount": - err = unpopulate(val, &a.TargetNodeCount) - delete(rawMsg, key) - case "userAccountCredentials": - err = unpopulate(val, &a.UserAccountCredentials) - delete(rawMsg, key) - case "vmPriority": - err = unpopulate(val, &a.VMPriority) - delete(rawMsg, key) - case "vmSize": - err = unpopulate(val, &a.VMSize) - delete(rawMsg, key) - case "virtualMachineImage": - err = unpopulate(val, &a.VirtualMachineImage) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AmlUserFeature - Features enabled for a workspace type AmlUserFeature struct { // Describes the feature for user experience @@ -618,13 +291,6 @@ type ClusterUpdateParameters struct { Properties *ClusterUpdateProperties `json:"properties,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ClusterUpdateParameters. -func (c ClusterUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", c.Properties) - return json.Marshal(objectMap) -} - // ClusterUpdateProperties - The properties of a amlCompute that need to be updated. type ClusterUpdateProperties struct { // Properties of ClusterUpdate @@ -636,33 +302,6 @@ type Components1D3SwueSchemasComputeresourceAllof1 struct { Properties ComputeClassification `json:"properties,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type Components1D3SwueSchemasComputeresourceAllof1. -func (c Components1D3SwueSchemasComputeresourceAllof1) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", c.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Components1D3SwueSchemasComputeresourceAllof1. -func (c *Components1D3SwueSchemasComputeresourceAllof1) 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 = unmarshalComputeClassification(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ComputeClassification provides polymorphic access to related types. // Call the interface's GetCompute() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -707,100 +346,40 @@ type Compute struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// GetCompute implements the ComputeClassification interface for type Compute. -func (c *Compute) GetCompute() *Compute { return c } - -// MarshalJSON implements the json.Marshaller interface for type Compute. -func (c Compute) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "computeLocation", c.ComputeLocation) - objectMap["computeType"] = c.ComputeType - populateTimeRFC3339(objectMap, "createdOn", c.CreatedOn) - populate(objectMap, "description", c.Description) - populate(objectMap, "disableLocalAuth", c.DisableLocalAuth) - populate(objectMap, "isAttachedCompute", c.IsAttachedCompute) - populateTimeRFC3339(objectMap, "modifiedOn", c.ModifiedOn) - populate(objectMap, "provisioningErrors", c.ProvisioningErrors) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "resourceId", c.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Compute. -func (c *Compute) 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 "computeLocation": - err = unpopulate(val, &c.ComputeLocation) - delete(rawMsg, key) - case "computeType": - err = unpopulate(val, &c.ComputeType) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, &c.CreatedOn) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &c.Description) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, &c.DisableLocalAuth) - delete(rawMsg, key) - case "isAttachedCompute": - err = unpopulate(val, &c.IsAttachedCompute) - delete(rawMsg, key) - case "modifiedOn": - err = unpopulateTimeRFC3339(val, &c.ModifiedOn) - delete(rawMsg, key) - case "provisioningErrors": - err = unpopulate(val, &c.ProvisioningErrors) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &c.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, &c.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ComputeClientBeginCreateOrUpdateOptions contains the optional parameters for the ComputeClient.BeginCreateOrUpdate method. type ComputeClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ComputeClientBeginDeleteOptions contains the optional parameters for the ComputeClient.BeginDelete method. type ComputeClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ComputeClientBeginRestartOptions contains the optional parameters for the ComputeClient.BeginRestart method. type ComputeClientBeginRestartOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ComputeClientBeginStartOptions contains the optional parameters for the ComputeClient.BeginStart method. type ComputeClientBeginStartOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ComputeClientBeginStopOptions contains the optional parameters for the ComputeClient.BeginStop method. type ComputeClientBeginStopOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ComputeClientBeginUpdateOptions contains the optional parameters for the ComputeClient.BeginUpdate method. type ComputeClientBeginUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ComputeClientGetOptions contains the optional parameters for the ComputeClient.Get method. @@ -861,89 +440,6 @@ type ComputeInstance struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// GetCompute implements the ComputeClassification interface for type ComputeInstance. -func (c *ComputeInstance) GetCompute() *Compute { - return &Compute{ - ComputeType: c.ComputeType, - ComputeLocation: c.ComputeLocation, - ProvisioningState: c.ProvisioningState, - Description: c.Description, - CreatedOn: c.CreatedOn, - ModifiedOn: c.ModifiedOn, - ResourceID: c.ResourceID, - ProvisioningErrors: c.ProvisioningErrors, - IsAttachedCompute: c.IsAttachedCompute, - DisableLocalAuth: c.DisableLocalAuth, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ComputeInstance. -func (c ComputeInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "computeLocation", c.ComputeLocation) - objectMap["computeType"] = ComputeTypeComputeInstance - populateTimeRFC3339(objectMap, "createdOn", c.CreatedOn) - populate(objectMap, "description", c.Description) - populate(objectMap, "disableLocalAuth", c.DisableLocalAuth) - populate(objectMap, "isAttachedCompute", c.IsAttachedCompute) - populateTimeRFC3339(objectMap, "modifiedOn", c.ModifiedOn) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "provisioningErrors", c.ProvisioningErrors) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "resourceId", c.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeInstance. -func (c *ComputeInstance) 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 "computeLocation": - err = unpopulate(val, &c.ComputeLocation) - delete(rawMsg, key) - case "computeType": - err = unpopulate(val, &c.ComputeType) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, &c.CreatedOn) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &c.Description) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, &c.DisableLocalAuth) - delete(rawMsg, key) - case "isAttachedCompute": - err = unpopulate(val, &c.IsAttachedCompute) - delete(rawMsg, key) - case "modifiedOn": - err = unpopulateTimeRFC3339(val, &c.ModifiedOn) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, &c.Properties) - delete(rawMsg, key) - case "provisioningErrors": - err = unpopulate(val, &c.ProvisioningErrors) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &c.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, &c.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ComputeInstanceApplication - Defines an Aml Instance application and its connectivity endpoint URI. type ComputeInstanceApplication struct { // Name of the ComputeInstance application. @@ -986,41 +482,6 @@ type ComputeInstanceLastOperation struct { OperationTime *time.Time `json:"operationTime,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ComputeInstanceLastOperation. -func (c ComputeInstanceLastOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "operationName", c.OperationName) - populate(objectMap, "operationStatus", c.OperationStatus) - populateTimeRFC3339(objectMap, "operationTime", c.OperationTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeInstanceLastOperation. -func (c *ComputeInstanceLastOperation) 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 "operationName": - err = unpopulate(val, &c.OperationName) - delete(rawMsg, key) - case "operationStatus": - err = unpopulate(val, &c.OperationStatus) - delete(rawMsg, key) - case "operationTime": - err = unpopulateTimeRFC3339(val, &c.OperationTime) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ComputeInstanceProperties - Compute Instance properties type ComputeInstanceProperties struct { // Policy for sharing applications on this compute instance among users of parent workspace. If Personal, only the creator @@ -1065,25 +526,6 @@ type ComputeInstanceProperties struct { State *ComputeInstanceState `json:"state,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ComputeInstanceProperties. -func (c ComputeInstanceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "applicationSharingPolicy", c.ApplicationSharingPolicy) - populate(objectMap, "applications", c.Applications) - populate(objectMap, "computeInstanceAuthorizationType", c.ComputeInstanceAuthorizationType) - populate(objectMap, "connectivityEndpoints", c.ConnectivityEndpoints) - populate(objectMap, "createdBy", c.CreatedBy) - populate(objectMap, "errors", c.Errors) - populate(objectMap, "lastOperation", c.LastOperation) - populate(objectMap, "personalComputeInstanceSettings", c.PersonalComputeInstanceSettings) - populate(objectMap, "sshSettings", c.SSHSettings) - populate(objectMap, "setupScripts", c.SetupScripts) - populate(objectMap, "state", c.State) - populate(objectMap, "subnet", c.Subnet) - populate(objectMap, "vmSize", c.VMSize) - return json.Marshal(objectMap) -} - // ComputeInstanceSSHSettings - Specifies policy and settings for SSH access. type ComputeInstanceSSHSettings struct { // Specifies the SSH rsa public key file as a string. Use "ssh-keygen -t rsa -b 2048" to generate your SSH key pairs. @@ -1131,65 +573,6 @@ type ComputeResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ComputeResource. -func (c ComputeResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "identity", c.Identity) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "sku", c.SKU) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeResource. -func (c *ComputeResource) 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 "id": - err = unpopulate(val, &c.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, &c.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, &c.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &c.Name) - delete(rawMsg, key) - case "properties": - c.Properties, err = unmarshalComputeClassification(val) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, &c.SKU) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, &c.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, &c.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &c.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ComputeSecretsClassification provides polymorphic access to related types. // Call the interface's GetComputeSecrets() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -1205,9 +588,6 @@ type ComputeSecrets struct { ComputeType *ComputeType `json:"computeType,omitempty"` } -// GetComputeSecrets implements the ComputeSecretsClassification interface for type ComputeSecrets. -func (c *ComputeSecrets) GetComputeSecrets() *ComputeSecrets { return c } - // ContainerResourceRequirements - The resource requirements for the container (cpu and memory). type ContainerResourceRequirements struct { // The minimum amount of CPU cores to be used by the container. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ @@ -1268,85 +648,6 @@ type DataFactory struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// GetCompute implements the ComputeClassification interface for type DataFactory. -func (d *DataFactory) GetCompute() *Compute { - return &Compute{ - ComputeType: d.ComputeType, - ComputeLocation: d.ComputeLocation, - ProvisioningState: d.ProvisioningState, - Description: d.Description, - CreatedOn: d.CreatedOn, - ModifiedOn: d.ModifiedOn, - ResourceID: d.ResourceID, - ProvisioningErrors: d.ProvisioningErrors, - IsAttachedCompute: d.IsAttachedCompute, - DisableLocalAuth: d.DisableLocalAuth, - } -} - -// MarshalJSON implements the json.Marshaller interface for type DataFactory. -func (d DataFactory) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "computeLocation", d.ComputeLocation) - objectMap["computeType"] = ComputeTypeDataFactory - populateTimeRFC3339(objectMap, "createdOn", d.CreatedOn) - populate(objectMap, "description", d.Description) - populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) - populate(objectMap, "isAttachedCompute", d.IsAttachedCompute) - populateTimeRFC3339(objectMap, "modifiedOn", d.ModifiedOn) - populate(objectMap, "provisioningErrors", d.ProvisioningErrors) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "resourceId", d.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataFactory. -func (d *DataFactory) 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 "computeLocation": - err = unpopulate(val, &d.ComputeLocation) - delete(rawMsg, key) - case "computeType": - err = unpopulate(val, &d.ComputeType) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, &d.CreatedOn) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &d.Description) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, &d.DisableLocalAuth) - delete(rawMsg, key) - case "isAttachedCompute": - err = unpopulate(val, &d.IsAttachedCompute) - delete(rawMsg, key) - case "modifiedOn": - err = unpopulateTimeRFC3339(val, &d.ModifiedOn) - delete(rawMsg, key) - case "provisioningErrors": - err = unpopulate(val, &d.ProvisioningErrors) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &d.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, &d.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // DataLakeAnalytics - A DataLakeAnalytics compute. type DataLakeAnalytics struct { // REQUIRED; The type of compute @@ -1382,89 +683,6 @@ type DataLakeAnalytics struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// GetCompute implements the ComputeClassification interface for type DataLakeAnalytics. -func (d *DataLakeAnalytics) GetCompute() *Compute { - return &Compute{ - ComputeType: d.ComputeType, - ComputeLocation: d.ComputeLocation, - ProvisioningState: d.ProvisioningState, - Description: d.Description, - CreatedOn: d.CreatedOn, - ModifiedOn: d.ModifiedOn, - ResourceID: d.ResourceID, - ProvisioningErrors: d.ProvisioningErrors, - IsAttachedCompute: d.IsAttachedCompute, - DisableLocalAuth: d.DisableLocalAuth, - } -} - -// MarshalJSON implements the json.Marshaller interface for type DataLakeAnalytics. -func (d DataLakeAnalytics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "computeLocation", d.ComputeLocation) - objectMap["computeType"] = ComputeTypeDataLakeAnalytics - populateTimeRFC3339(objectMap, "createdOn", d.CreatedOn) - populate(objectMap, "description", d.Description) - populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) - populate(objectMap, "isAttachedCompute", d.IsAttachedCompute) - populateTimeRFC3339(objectMap, "modifiedOn", d.ModifiedOn) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "provisioningErrors", d.ProvisioningErrors) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "resourceId", d.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataLakeAnalytics. -func (d *DataLakeAnalytics) 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 "computeLocation": - err = unpopulate(val, &d.ComputeLocation) - delete(rawMsg, key) - case "computeType": - err = unpopulate(val, &d.ComputeType) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, &d.CreatedOn) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &d.Description) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, &d.DisableLocalAuth) - delete(rawMsg, key) - case "isAttachedCompute": - err = unpopulate(val, &d.IsAttachedCompute) - delete(rawMsg, key) - case "modifiedOn": - err = unpopulateTimeRFC3339(val, &d.ModifiedOn) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, &d.Properties) - delete(rawMsg, key) - case "provisioningErrors": - err = unpopulate(val, &d.ProvisioningErrors) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &d.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, &d.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - type DataLakeAnalyticsProperties struct { // DataLake Store Account Name DataLakeStoreAccountName *string `json:"dataLakeStoreAccountName,omitempty"` @@ -1507,89 +725,6 @@ type Databricks struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// GetCompute implements the ComputeClassification interface for type Databricks. -func (d *Databricks) GetCompute() *Compute { - return &Compute{ - ComputeType: d.ComputeType, - ComputeLocation: d.ComputeLocation, - ProvisioningState: d.ProvisioningState, - Description: d.Description, - CreatedOn: d.CreatedOn, - ModifiedOn: d.ModifiedOn, - ResourceID: d.ResourceID, - ProvisioningErrors: d.ProvisioningErrors, - IsAttachedCompute: d.IsAttachedCompute, - DisableLocalAuth: d.DisableLocalAuth, - } -} - -// MarshalJSON implements the json.Marshaller interface for type Databricks. -func (d Databricks) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "computeLocation", d.ComputeLocation) - objectMap["computeType"] = ComputeTypeDatabricks - populateTimeRFC3339(objectMap, "createdOn", d.CreatedOn) - populate(objectMap, "description", d.Description) - populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) - populate(objectMap, "isAttachedCompute", d.IsAttachedCompute) - populateTimeRFC3339(objectMap, "modifiedOn", d.ModifiedOn) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "provisioningErrors", d.ProvisioningErrors) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "resourceId", d.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Databricks. -func (d *Databricks) 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 "computeLocation": - err = unpopulate(val, &d.ComputeLocation) - delete(rawMsg, key) - case "computeType": - err = unpopulate(val, &d.ComputeType) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, &d.CreatedOn) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &d.Description) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, &d.DisableLocalAuth) - delete(rawMsg, key) - case "isAttachedCompute": - err = unpopulate(val, &d.IsAttachedCompute) - delete(rawMsg, key) - case "modifiedOn": - err = unpopulateTimeRFC3339(val, &d.ModifiedOn) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, &d.Properties) - delete(rawMsg, key) - case "provisioningErrors": - err = unpopulate(val, &d.ProvisioningErrors) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &d.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, &d.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // DatabricksComputeSecrets - Secrets related to a Machine Learning compute based on Databricks. type DatabricksComputeSecrets struct { // REQUIRED; The type of compute @@ -1599,44 +734,6 @@ type DatabricksComputeSecrets struct { DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` } -// GetComputeSecrets implements the ComputeSecretsClassification interface for type DatabricksComputeSecrets. -func (d *DatabricksComputeSecrets) GetComputeSecrets() *ComputeSecrets { - return &ComputeSecrets{ - ComputeType: d.ComputeType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type DatabricksComputeSecrets. -func (d DatabricksComputeSecrets) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["computeType"] = ComputeTypeDatabricks - populate(objectMap, "databricksAccessToken", d.DatabricksAccessToken) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabricksComputeSecrets. -func (d *DatabricksComputeSecrets) 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 "computeType": - err = unpopulate(val, &d.ComputeType) - delete(rawMsg, key) - case "databricksAccessToken": - err = unpopulate(val, &d.DatabricksAccessToken) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // DatabricksComputeSecretsProperties - Properties of Databricks Compute Secrets type DatabricksComputeSecretsProperties struct { // access token for databricks account. @@ -1654,46 +751,31 @@ type DatabricksProperties struct { type DiagnoseRequestProperties struct { // Setting for diagnosing dependent application insights - ApplicationInsights map[string]map[string]interface{} `json:"applicationInsights,omitempty"` + ApplicationInsights map[string]interface{} `json:"applicationInsights,omitempty"` // Setting for diagnosing dependent container registry - ContainerRegistry map[string]map[string]interface{} `json:"containerRegistry,omitempty"` + ContainerRegistry map[string]interface{} `json:"containerRegistry,omitempty"` // Setting for diagnosing dns resolution - DNSResolution map[string]map[string]interface{} `json:"dnsResolution,omitempty"` + DNSResolution map[string]interface{} `json:"dnsResolution,omitempty"` // Setting for diagnosing dependent key vault - KeyVault map[string]map[string]interface{} `json:"keyVault,omitempty"` + KeyVault map[string]interface{} `json:"keyVault,omitempty"` // Setting for diagnosing network security group - Nsg map[string]map[string]interface{} `json:"nsg,omitempty"` + Nsg map[string]interface{} `json:"nsg,omitempty"` // Setting for diagnosing unclassified category of problems - Others map[string]map[string]interface{} `json:"others,omitempty"` + Others map[string]interface{} `json:"others,omitempty"` // Setting for diagnosing resource lock - ResourceLock map[string]map[string]interface{} `json:"resourceLock,omitempty"` + ResourceLock map[string]interface{} `json:"resourceLock,omitempty"` // Setting for diagnosing dependent storage account - StorageAccount map[string]map[string]interface{} `json:"storageAccount,omitempty"` + StorageAccount map[string]interface{} `json:"storageAccount,omitempty"` // Setting for diagnosing user defined routing - Udr map[string]map[string]interface{} `json:"udr,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnoseRequestProperties. -func (d DiagnoseRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "applicationInsights", d.ApplicationInsights) - populate(objectMap, "containerRegistry", d.ContainerRegistry) - populate(objectMap, "dnsResolution", d.DNSResolution) - populate(objectMap, "keyVault", d.KeyVault) - populate(objectMap, "nsg", d.Nsg) - populate(objectMap, "others", d.Others) - populate(objectMap, "resourceLock", d.ResourceLock) - populate(objectMap, "storageAccount", d.StorageAccount) - populate(objectMap, "udr", d.Udr) - return json.Marshal(objectMap) + Udr map[string]interface{} `json:"udr,omitempty"` } type DiagnoseResponseResult struct { @@ -1712,21 +794,6 @@ type DiagnoseResponseResultValue struct { UserDefinedRouteResults []*DiagnoseResult `json:"userDefinedRouteResults,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type DiagnoseResponseResultValue. -func (d DiagnoseResponseResultValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "applicationInsightsResults", d.ApplicationInsightsResults) - populate(objectMap, "containerRegistryResults", d.ContainerRegistryResults) - populate(objectMap, "dnsResolutionResults", d.DNSResolutionResults) - populate(objectMap, "keyVaultResults", d.KeyVaultResults) - populate(objectMap, "networkSecurityRuleResults", d.NetworkSecurityRuleResults) - populate(objectMap, "otherResults", d.OtherResults) - populate(objectMap, "resourceLockResults", d.ResourceLockResults) - populate(objectMap, "storageAccountResults", d.StorageAccountResults) - populate(objectMap, "userDefinedRouteResults", d.UserDefinedRouteResults) - return json.Marshal(objectMap) -} - // DiagnoseResult - Result of Diagnose type DiagnoseResult struct { // READ-ONLY; Code for workspace setup error @@ -1759,7 +826,7 @@ type EncryptionProperty struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info map[string]interface{} `json:"info,omitempty" azure:"ro"` + Info interface{} `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -1783,17 +850,6 @@ type ErrorDetail struct { 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 - Common error response for all Azure Resource Manager APIs to return error details for failed operations. // (This also follows the OData error response format.). type ErrorResponse struct { @@ -1825,39 +881,15 @@ type EstimatedVMPrices struct { Values []*EstimatedVMPrice `json:"values,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type EstimatedVMPrices. -func (e EstimatedVMPrices) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "billingCurrency", e.BillingCurrency) - populate(objectMap, "unitOfMeasure", e.UnitOfMeasure) - populate(objectMap, "values", e.Values) - return json.Marshal(objectMap) -} - type ExternalFQDNResponse struct { Value []*FQDNEndpoints `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ExternalFQDNResponse. -func (e ExternalFQDNResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - type FQDNEndpoint struct { DomainName *string `json:"domainName,omitempty"` EndpointDetails []*FQDNEndpointDetail `json:"endpointDetails,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type FQDNEndpoint. -func (f FQDNEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "domainName", f.DomainName) - populate(objectMap, "endpointDetails", f.EndpointDetails) - return json.Marshal(objectMap) -} - type FQDNEndpointDetail struct { Port *int32 `json:"port,omitempty"` } @@ -1871,14 +903,6 @@ type FQDNEndpointsProperties struct { Endpoints []*FQDNEndpoint `json:"endpoints,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type FQDNEndpointsProperties. -func (f FQDNEndpointsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "category", f.Category) - populate(objectMap, "endpoints", f.Endpoints) - return json.Marshal(objectMap) -} - // HDInsight - A HDInsight compute. type HDInsight struct { // REQUIRED; The type of compute @@ -1916,89 +940,6 @@ type HDInsight struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// GetCompute implements the ComputeClassification interface for type HDInsight. -func (h *HDInsight) GetCompute() *Compute { - return &Compute{ - ComputeType: h.ComputeType, - ComputeLocation: h.ComputeLocation, - ProvisioningState: h.ProvisioningState, - Description: h.Description, - CreatedOn: h.CreatedOn, - ModifiedOn: h.ModifiedOn, - ResourceID: h.ResourceID, - ProvisioningErrors: h.ProvisioningErrors, - IsAttachedCompute: h.IsAttachedCompute, - DisableLocalAuth: h.DisableLocalAuth, - } -} - -// MarshalJSON implements the json.Marshaller interface for type HDInsight. -func (h HDInsight) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "computeLocation", h.ComputeLocation) - objectMap["computeType"] = ComputeTypeHDInsight - populateTimeRFC3339(objectMap, "createdOn", h.CreatedOn) - populate(objectMap, "description", h.Description) - populate(objectMap, "disableLocalAuth", h.DisableLocalAuth) - populate(objectMap, "isAttachedCompute", h.IsAttachedCompute) - populateTimeRFC3339(objectMap, "modifiedOn", h.ModifiedOn) - populate(objectMap, "properties", h.Properties) - populate(objectMap, "provisioningErrors", h.ProvisioningErrors) - populate(objectMap, "provisioningState", h.ProvisioningState) - populate(objectMap, "resourceId", h.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HDInsight. -func (h *HDInsight) 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 "computeLocation": - err = unpopulate(val, &h.ComputeLocation) - delete(rawMsg, key) - case "computeType": - err = unpopulate(val, &h.ComputeType) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, &h.CreatedOn) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &h.Description) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, &h.DisableLocalAuth) - delete(rawMsg, key) - case "isAttachedCompute": - err = unpopulate(val, &h.IsAttachedCompute) - delete(rawMsg, key) - case "modifiedOn": - err = unpopulateTimeRFC3339(val, &h.ModifiedOn) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, &h.Properties) - delete(rawMsg, key) - case "provisioningErrors": - err = unpopulate(val, &h.ProvisioningErrors) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &h.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, &h.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // HDInsightProperties - HDInsight compute properties type HDInsightProperties struct { // Public IP address of the master node of the cluster. @@ -2026,16 +967,6 @@ type Identity struct { TenantID *string `json:"tenantId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - populate(objectMap, "type", i.Type) - populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) - return json.Marshal(objectMap) -} - // IdentityForCmk - Identity that will be used to access key vault for encryption at rest type IdentityForCmk struct { // The ArmId of the user assigned identity that will be used to access the customer managed key vault @@ -2051,14 +982,6 @@ type InstanceTypeSchema struct { Resources *InstanceTypeSchemaResources `json:"resources,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type InstanceTypeSchema. -func (i InstanceTypeSchema) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nodeSelector", i.NodeSelector) - populate(objectMap, "resources", i.Resources) - return json.Marshal(objectMap) -} - // InstanceTypeSchemaResources - Resource requests/limits for this instance type type InstanceTypeSchemaResources struct { // Resource limits for this instance type @@ -2068,14 +991,6 @@ type InstanceTypeSchemaResources struct { Requests map[string]*string `json:"requests,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type InstanceTypeSchemaResources. -func (i InstanceTypeSchemaResources) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "limits", i.Limits) - populate(objectMap, "requests", i.Requests) - return json.Marshal(objectMap) -} - type KeyVaultProperties struct { // REQUIRED; Key vault uri to access the encryption key. KeyIdentifier *string `json:"keyIdentifier,omitempty"` @@ -2124,89 +1039,6 @@ type Kubernetes struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// GetCompute implements the ComputeClassification interface for type Kubernetes. -func (k *Kubernetes) GetCompute() *Compute { - return &Compute{ - ComputeType: k.ComputeType, - ComputeLocation: k.ComputeLocation, - ProvisioningState: k.ProvisioningState, - Description: k.Description, - CreatedOn: k.CreatedOn, - ModifiedOn: k.ModifiedOn, - ResourceID: k.ResourceID, - ProvisioningErrors: k.ProvisioningErrors, - IsAttachedCompute: k.IsAttachedCompute, - DisableLocalAuth: k.DisableLocalAuth, - } -} - -// MarshalJSON implements the json.Marshaller interface for type Kubernetes. -func (k Kubernetes) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "computeLocation", k.ComputeLocation) - objectMap["computeType"] = ComputeTypeKubernetes - populateTimeRFC3339(objectMap, "createdOn", k.CreatedOn) - populate(objectMap, "description", k.Description) - populate(objectMap, "disableLocalAuth", k.DisableLocalAuth) - populate(objectMap, "isAttachedCompute", k.IsAttachedCompute) - populateTimeRFC3339(objectMap, "modifiedOn", k.ModifiedOn) - populate(objectMap, "properties", k.Properties) - populate(objectMap, "provisioningErrors", k.ProvisioningErrors) - populate(objectMap, "provisioningState", k.ProvisioningState) - populate(objectMap, "resourceId", k.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Kubernetes. -func (k *Kubernetes) 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 "computeLocation": - err = unpopulate(val, &k.ComputeLocation) - delete(rawMsg, key) - case "computeType": - err = unpopulate(val, &k.ComputeType) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, &k.CreatedOn) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &k.Description) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, &k.DisableLocalAuth) - delete(rawMsg, key) - case "isAttachedCompute": - err = unpopulate(val, &k.IsAttachedCompute) - delete(rawMsg, key) - case "modifiedOn": - err = unpopulateTimeRFC3339(val, &k.ModifiedOn) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, &k.Properties) - delete(rawMsg, key) - case "provisioningErrors": - err = unpopulate(val, &k.ProvisioningErrors) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &k.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, &k.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // KubernetesProperties - Kubernetes properties type KubernetesProperties struct { // Default instance type @@ -2234,20 +1066,6 @@ type KubernetesProperties struct { VcName *string `json:"vcName,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type KubernetesProperties. -func (k KubernetesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "defaultInstanceType", k.DefaultInstanceType) - populate(objectMap, "extensionInstanceReleaseTrain", k.ExtensionInstanceReleaseTrain) - populate(objectMap, "extensionPrincipalId", k.ExtensionPrincipalID) - populate(objectMap, "instanceTypes", k.InstanceTypes) - populate(objectMap, "namespace", k.Namespace) - populate(objectMap, "relayConnectionString", k.RelayConnectionString) - populate(objectMap, "serviceBusConnectionString", k.ServiceBusConnectionString) - populate(objectMap, "vcName", k.VcName) - return json.Marshal(objectMap) -} - // KubernetesSchema - Kubernetes Compute Schema type KubernetesSchema struct { // Properties of Kubernetes @@ -2264,14 +1082,6 @@ type ListAmlUserFeatureResult struct { Value []*AmlUserFeature `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ListAmlUserFeatureResult. -func (l ListAmlUserFeatureResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", l.NextLink) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - type ListNotebookKeysResult struct { // READ-ONLY PrimaryAccessKey *string `json:"primaryAccessKey,omitempty" azure:"ro"` @@ -2295,14 +1105,6 @@ type ListUsagesResult struct { Value []*Usage `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ListUsagesResult. -func (l ListUsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", l.NextLink) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - type ListWorkspaceKeysResult struct { // READ-ONLY AppInsightsInstrumentationKey *string `json:"appInsightsInstrumentationKey,omitempty" azure:"ro"` @@ -2330,14 +1132,6 @@ type ListWorkspaceQuotas struct { Value []*ResourceQuota `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ListWorkspaceQuotas. -func (l ListWorkspaceQuotas) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", l.NextLink) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - // NodeStateCounts - Counts of various compute node states on the amlCompute. type NodeStateCounts struct { // READ-ONLY; Number of compute nodes in idle state. @@ -2430,13 +1224,6 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -2451,14 +1238,6 @@ type PaginatedComputeResourcesList struct { Value []*ComputeResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PaginatedComputeResourcesList. -func (p PaginatedComputeResourcesList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PaginatedWorkspaceConnectionsList - Paginated list of Workspace connection objects. type PaginatedWorkspaceConnectionsList struct { // A continuation link (absolute URI) to the next page of results in the list. @@ -2468,14 +1247,6 @@ type PaginatedWorkspaceConnectionsList struct { Value []*WorkspaceConnection `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PaginatedWorkspaceConnectionsList. -func (p PaginatedWorkspaceConnectionsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - type Password struct { // READ-ONLY Name *string `json:"name,omitempty" azure:"ro"` @@ -2529,34 +1300,12 @@ type PrivateEndpointConnection struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "sku", p.SKU) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - // PrivateEndpointConnectionListResult - List of private endpoint connection associated with the specified workspace type PrivateEndpointConnectionListResult struct { // Array of private endpoint connections Value []*PrivateEndpointConnection `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. -func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. type PrivateEndpointConnectionProperties struct { // REQUIRED; A collection of information about the state of the connection between service consumer and provider. @@ -2623,34 +1372,12 @@ type PrivateLinkResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. -func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "sku", p.SKU) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - // PrivateLinkResourceListResult - A list of private link resources type PrivateLinkResourceListResult struct { // Array of private link resources Value []*PrivateLinkResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. -func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PrivateLinkResourceProperties - Properties of a private link resource. type PrivateLinkResourceProperties struct { // The private link resource Private link DNS zone name. @@ -2663,15 +1390,6 @@ type PrivateLinkResourceProperties struct { RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) - return json.Marshal(objectMap) -} - // PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List method. type PrivateLinkResourcesClientListOptions struct { // placeholder for future optional parameters @@ -2714,14 +1432,6 @@ type QuotaUpdateParameters struct { Value []*QuotaBaseProperties `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type QuotaUpdateParameters. -func (q QuotaUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "location", q.Location) - populate(objectMap, "value", q.Value) - return json.Marshal(objectMap) -} - // QuotasClientListOptions contains the optional parameters for the QuotasClient.List method. type QuotasClientListOptions struct { // placeholder for future optional parameters @@ -2742,15 +1452,6 @@ type RegistryListCredentialsResult struct { Username *string `json:"username,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type RegistryListCredentialsResult. -func (r RegistryListCredentialsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "location", r.Location) - populate(objectMap, "passwords", r.Passwords) - populate(objectMap, "username", r.Username) - 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} @@ -2810,15 +1511,6 @@ type ResourceSKULocationInfo struct { Zones []*string `json:"zones,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ResourceSKULocationInfo. -func (r ResourceSKULocationInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "location", r.Location) - populate(objectMap, "zoneDetails", r.ZoneDetails) - populate(objectMap, "zones", r.Zones) - return json.Marshal(objectMap) -} - // ResourceSKUZoneDetails - Describes The zonal capabilities of a SKU. type ResourceSKUZoneDetails struct { // READ-ONLY; A list of capabilities that are available for the SKU in the specified list of zones. @@ -2828,14 +1520,6 @@ type ResourceSKUZoneDetails struct { Name []*string `json:"name,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ResourceSKUZoneDetails. -func (r ResourceSKUZoneDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "capabilities", r.Capabilities) - populate(objectMap, "name", r.Name) - return json.Marshal(objectMap) -} - // Restriction - The restriction because of which SKU cannot be used. type Restriction struct { // The reason for the restriction. @@ -2849,15 +1533,6 @@ type Restriction struct { Values []*string `json:"values,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Restriction. -func (r Restriction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "reasonCode", r.ReasonCode) - populate(objectMap, "type", r.Type) - populate(objectMap, "values", r.Values) - return json.Marshal(objectMap) -} - // SKU - Sku of the resource type SKU struct { // Name of the sku @@ -2883,14 +1558,6 @@ type SKUListResult struct { Value []*WorkspaceSKU `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SKUListResult. -func (s SKUListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - // SSLConfiguration - The ssl configuration for scoring type SSLConfiguration struct { // Cert data @@ -3032,89 +1699,6 @@ type SynapseSpark struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// GetCompute implements the ComputeClassification interface for type SynapseSpark. -func (s *SynapseSpark) GetCompute() *Compute { - return &Compute{ - ComputeType: s.ComputeType, - ComputeLocation: s.ComputeLocation, - ProvisioningState: s.ProvisioningState, - Description: s.Description, - CreatedOn: s.CreatedOn, - ModifiedOn: s.ModifiedOn, - ResourceID: s.ResourceID, - ProvisioningErrors: s.ProvisioningErrors, - IsAttachedCompute: s.IsAttachedCompute, - DisableLocalAuth: s.DisableLocalAuth, - } -} - -// MarshalJSON implements the json.Marshaller interface for type SynapseSpark. -func (s SynapseSpark) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "computeLocation", s.ComputeLocation) - objectMap["computeType"] = ComputeTypeSynapseSpark - populateTimeRFC3339(objectMap, "createdOn", s.CreatedOn) - populate(objectMap, "description", s.Description) - populate(objectMap, "disableLocalAuth", s.DisableLocalAuth) - populate(objectMap, "isAttachedCompute", s.IsAttachedCompute) - populateTimeRFC3339(objectMap, "modifiedOn", s.ModifiedOn) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "provisioningErrors", s.ProvisioningErrors) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "resourceId", s.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SynapseSpark. -func (s *SynapseSpark) 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 "computeLocation": - err = unpopulate(val, &s.ComputeLocation) - delete(rawMsg, key) - case "computeType": - err = unpopulate(val, &s.ComputeType) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, &s.CreatedOn) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &s.Description) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, &s.DisableLocalAuth) - delete(rawMsg, key) - case "isAttachedCompute": - err = unpopulate(val, &s.IsAttachedCompute) - delete(rawMsg, key) - case "modifiedOn": - err = unpopulateTimeRFC3339(val, &s.ModifiedOn) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, &s.Properties) - delete(rawMsg, key) - case "provisioningErrors": - err = unpopulate(val, &s.ProvisioningErrors) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &s.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, &s.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - type SynapseSparkProperties struct { // Auto pause properties. AutoPauseProperties *AutoPauseProperties `json:"autoPauseProperties,omitempty"` @@ -3168,53 +1752,6 @@ type SystemData struct { 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 -} - // SystemService - A system service running on a compute. type SystemService struct { // READ-ONLY; Public IP address @@ -3255,14 +1792,6 @@ type UpdateWorkspaceQuotasResult struct { Value []*UpdateWorkspaceQuotas `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type UpdateWorkspaceQuotasResult. -func (u UpdateWorkspaceQuotasResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", u.NextLink) - populate(objectMap, "value", u.Value) - return json.Marshal(objectMap) -} - // Usage - Describes AML Resource Usage. type Usage struct { // READ-ONLY; Region of the AML workspace in the id. @@ -3360,89 +1889,6 @@ type VirtualMachine struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// GetCompute implements the ComputeClassification interface for type VirtualMachine. -func (v *VirtualMachine) GetCompute() *Compute { - return &Compute{ - ComputeType: v.ComputeType, - ComputeLocation: v.ComputeLocation, - ProvisioningState: v.ProvisioningState, - Description: v.Description, - CreatedOn: v.CreatedOn, - ModifiedOn: v.ModifiedOn, - ResourceID: v.ResourceID, - ProvisioningErrors: v.ProvisioningErrors, - IsAttachedCompute: v.IsAttachedCompute, - DisableLocalAuth: v.DisableLocalAuth, - } -} - -// MarshalJSON implements the json.Marshaller interface for type VirtualMachine. -func (v VirtualMachine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "computeLocation", v.ComputeLocation) - objectMap["computeType"] = ComputeTypeVirtualMachine - populateTimeRFC3339(objectMap, "createdOn", v.CreatedOn) - populate(objectMap, "description", v.Description) - populate(objectMap, "disableLocalAuth", v.DisableLocalAuth) - populate(objectMap, "isAttachedCompute", v.IsAttachedCompute) - populateTimeRFC3339(objectMap, "modifiedOn", v.ModifiedOn) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "provisioningErrors", v.ProvisioningErrors) - populate(objectMap, "provisioningState", v.ProvisioningState) - populate(objectMap, "resourceId", v.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachine. -func (v *VirtualMachine) 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 "computeLocation": - err = unpopulate(val, &v.ComputeLocation) - delete(rawMsg, key) - case "computeType": - err = unpopulate(val, &v.ComputeType) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, &v.CreatedOn) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &v.Description) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, &v.DisableLocalAuth) - delete(rawMsg, key) - case "isAttachedCompute": - err = unpopulate(val, &v.IsAttachedCompute) - delete(rawMsg, key) - case "modifiedOn": - err = unpopulateTimeRFC3339(val, &v.ModifiedOn) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, &v.Properties) - delete(rawMsg, key) - case "provisioningErrors": - err = unpopulate(val, &v.ProvisioningErrors) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &v.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, &v.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // VirtualMachineImage - Virtual Machine image for Windows AML Compute type VirtualMachineImage struct { // REQUIRED; Virtual Machine image path @@ -3490,44 +1936,6 @@ type VirtualMachineSecrets struct { AdministratorAccount *VirtualMachineSSHCredentials `json:"administratorAccount,omitempty"` } -// GetComputeSecrets implements the ComputeSecretsClassification interface for type VirtualMachineSecrets. -func (v *VirtualMachineSecrets) GetComputeSecrets() *ComputeSecrets { - return &ComputeSecrets{ - ComputeType: v.ComputeType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineSecrets. -func (v VirtualMachineSecrets) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "administratorAccount", v.AdministratorAccount) - objectMap["computeType"] = ComputeTypeVirtualMachine - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineSecrets. -func (v *VirtualMachineSecrets) 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 "administratorAccount": - err = unpopulate(val, &v.AdministratorAccount) - delete(rawMsg, key) - case "computeType": - err = unpopulate(val, &v.ComputeType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // VirtualMachineSize - Describes the properties of a VM size. type VirtualMachineSize struct { // The estimated price information for using a VM. @@ -3564,36 +1972,12 @@ type VirtualMachineSize struct { VCPUs *int32 `json:"vCPUs,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineSize. -func (v VirtualMachineSize) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "estimatedVMPrices", v.EstimatedVMPrices) - populate(objectMap, "family", v.Family) - populate(objectMap, "gpus", v.Gpus) - populate(objectMap, "lowPriorityCapable", v.LowPriorityCapable) - populate(objectMap, "maxResourceVolumeMB", v.MaxResourceVolumeMB) - populate(objectMap, "memoryGB", v.MemoryGB) - populate(objectMap, "name", v.Name) - populate(objectMap, "osVhdSizeMB", v.OSVhdSizeMB) - populate(objectMap, "premiumIO", v.PremiumIO) - populate(objectMap, "supportedComputeTypes", v.SupportedComputeTypes) - populate(objectMap, "vCPUs", v.VCPUs) - return json.Marshal(objectMap) -} - // VirtualMachineSizeListResult - The List Virtual Machine size operation response. type VirtualMachineSizeListResult struct { // The list of virtual machine sizes supported by AmlCompute. Value []*VirtualMachineSize `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineSizeListResult. -func (v VirtualMachineSizeListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", v.Value) - return json.Marshal(objectMap) -} - // VirtualMachineSizesClientListOptions contains the optional parameters for the VirtualMachineSizesClient.List method. type VirtualMachineSizesClientListOptions struct { // placeholder for future optional parameters @@ -3629,21 +2013,6 @@ type Workspace struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Workspace. -func (w Workspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", w.ID) - populate(objectMap, "identity", w.Identity) - populate(objectMap, "location", w.Location) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "sku", w.SKU) - populate(objectMap, "systemData", w.SystemData) - populate(objectMap, "tags", w.Tags) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - // WorkspaceConnection - Workspace connection. type WorkspaceConnection struct { // Properties of workspace connection. @@ -3715,14 +2084,6 @@ type WorkspaceListResult struct { Value []*Workspace `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type WorkspaceListResult. -func (w WorkspaceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", w.NextLink) - populate(objectMap, "value", w.Value) - return json.Marshal(objectMap) -} - // WorkspaceProperties - The properties of a machine learning workspace. type WorkspaceProperties struct { // The flag to indicate whether to allow public access when behind VNet. @@ -3800,36 +2161,6 @@ type WorkspaceProperties struct { WorkspaceID *string `json:"workspaceId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type WorkspaceProperties. -func (w WorkspaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowPublicAccessWhenBehindVnet", w.AllowPublicAccessWhenBehindVnet) - populate(objectMap, "applicationInsights", w.ApplicationInsights) - populate(objectMap, "containerRegistry", w.ContainerRegistry) - populate(objectMap, "description", w.Description) - populate(objectMap, "discoveryUrl", w.DiscoveryURL) - populate(objectMap, "encryption", w.Encryption) - populate(objectMap, "friendlyName", w.FriendlyName) - populate(objectMap, "hbiWorkspace", w.HbiWorkspace) - populate(objectMap, "imageBuildCompute", w.ImageBuildCompute) - populate(objectMap, "keyVault", w.KeyVault) - populate(objectMap, "mlFlowTrackingUri", w.MlFlowTrackingURI) - populate(objectMap, "notebookInfo", w.NotebookInfo) - populate(objectMap, "primaryUserAssignedIdentity", w.PrimaryUserAssignedIdentity) - populate(objectMap, "privateEndpointConnections", w.PrivateEndpointConnections) - populate(objectMap, "privateLinkCount", w.PrivateLinkCount) - populate(objectMap, "provisioningState", w.ProvisioningState) - populate(objectMap, "publicNetworkAccess", w.PublicNetworkAccess) - populate(objectMap, "serviceManagedResourcesSettings", w.ServiceManagedResourcesSettings) - populate(objectMap, "serviceProvisionedResourceGroup", w.ServiceProvisionedResourceGroup) - populate(objectMap, "sharedPrivateLinkResources", w.SharedPrivateLinkResources) - populate(objectMap, "storageAccount", w.StorageAccount) - populate(objectMap, "storageHnsEnabled", w.StorageHnsEnabled) - populate(objectMap, "tenantId", w.TenantID) - populate(objectMap, "workspaceId", w.WorkspaceID) - return json.Marshal(objectMap) -} - // WorkspacePropertiesUpdateParameters - The parameters for updating the properties of a machine learning workspace. type WorkspacePropertiesUpdateParameters struct { // The description of this workspace. @@ -3876,19 +2207,6 @@ type WorkspaceSKU struct { Tier *string `json:"tier,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type WorkspaceSKU. -func (w WorkspaceSKU) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "capabilities", w.Capabilities) - populate(objectMap, "locationInfo", w.LocationInfo) - populate(objectMap, "locations", w.Locations) - populate(objectMap, "name", w.Name) - populate(objectMap, "resourceType", w.ResourceType) - populate(objectMap, "restrictions", w.Restrictions) - populate(objectMap, "tier", w.Tier) - return json.Marshal(objectMap) -} - // WorkspaceSKUsClientListOptions contains the optional parameters for the WorkspaceSKUsClient.List method. type WorkspaceSKUsClientListOptions struct { // placeholder for future optional parameters @@ -3909,42 +2227,38 @@ type WorkspaceUpdateParameters struct { Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type WorkspaceUpdateParameters. -func (w WorkspaceUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", w.Identity) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "sku", w.SKU) - populate(objectMap, "tags", w.Tags) - return json.Marshal(objectMap) -} - // WorkspacesClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkspacesClient.BeginCreateOrUpdate // method. type WorkspacesClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // WorkspacesClientBeginDeleteOptions contains the optional parameters for the WorkspacesClient.BeginDelete method. type WorkspacesClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // WorkspacesClientBeginDiagnoseOptions contains the optional parameters for the WorkspacesClient.BeginDiagnose method. type WorkspacesClientBeginDiagnoseOptions struct { // The parameter of diagnosing workspace health Parameters *DiagnoseWorkspaceParameters + // Resumes the LRO from the provided token. + ResumeToken string } // WorkspacesClientBeginPrepareNotebookOptions contains the optional parameters for the WorkspacesClient.BeginPrepareNotebook // method. type WorkspacesClientBeginPrepareNotebookOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // WorkspacesClientBeginResyncKeysOptions contains the optional parameters for the WorkspacesClient.BeginResyncKeys method. type WorkspacesClientBeginResyncKeysOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // WorkspacesClientGetOptions contains the optional parameters for the WorkspacesClient.Get method. @@ -3998,20 +2312,3 @@ type WorkspacesClientListStorageAccountKeysOptions struct { type WorkspacesClientUpdateOptions struct { // placeholder for future optional parameters } - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_models_serde.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_models_serde.go new file mode 100644 index 000000000000..1d6511c87a02 --- /dev/null +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_models_serde.go @@ -0,0 +1,1725 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmachinelearningservices + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// GetCompute implements the ComputeClassification interface for type AKS. +func (a *AKS) GetCompute() *Compute { + return &Compute{ + ComputeType: a.ComputeType, + ComputeLocation: a.ComputeLocation, + ProvisioningState: a.ProvisioningState, + Description: a.Description, + CreatedOn: a.CreatedOn, + ModifiedOn: a.ModifiedOn, + ResourceID: a.ResourceID, + ProvisioningErrors: a.ProvisioningErrors, + IsAttachedCompute: a.IsAttachedCompute, + DisableLocalAuth: a.DisableLocalAuth, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AKS. +func (a AKS) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "computeLocation", a.ComputeLocation) + objectMap["computeType"] = ComputeTypeAKS + populateTimeRFC3339(objectMap, "createdOn", a.CreatedOn) + populate(objectMap, "description", a.Description) + populate(objectMap, "disableLocalAuth", a.DisableLocalAuth) + populate(objectMap, "isAttachedCompute", a.IsAttachedCompute) + populateTimeRFC3339(objectMap, "modifiedOn", a.ModifiedOn) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "provisioningErrors", a.ProvisioningErrors) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "resourceId", a.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AKS. +func (a *AKS) 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 "computeLocation": + err = unpopulate(val, &a.ComputeLocation) + delete(rawMsg, key) + case "computeType": + err = unpopulate(val, &a.ComputeType) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, &a.CreatedOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &a.Description) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, &a.DisableLocalAuth) + delete(rawMsg, key) + case "isAttachedCompute": + err = unpopulate(val, &a.IsAttachedCompute) + delete(rawMsg, key) + case "modifiedOn": + err = unpopulateTimeRFC3339(val, &a.ModifiedOn) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + case "provisioningErrors": + err = unpopulate(val, &a.ProvisioningErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &a.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, &a.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AKSProperties. +func (a AKSProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agentCount", a.AgentCount) + populate(objectMap, "agentVmSize", a.AgentVMSize) + populate(objectMap, "aksNetworkingConfiguration", a.AksNetworkingConfiguration) + populate(objectMap, "clusterFqdn", a.ClusterFqdn) + populate(objectMap, "clusterPurpose", a.ClusterPurpose) + populate(objectMap, "loadBalancerSubnet", a.LoadBalancerSubnet) + populate(objectMap, "loadBalancerType", a.LoadBalancerType) + populate(objectMap, "sslConfiguration", a.SSLConfiguration) + populate(objectMap, "systemServices", a.SystemServices) + return json.Marshal(objectMap) +} + +// GetComputeSecrets implements the ComputeSecretsClassification interface for type AksComputeSecrets. +func (a *AksComputeSecrets) GetComputeSecrets() *ComputeSecrets { + return &ComputeSecrets{ + ComputeType: a.ComputeType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AksComputeSecrets. +func (a AksComputeSecrets) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "adminKubeConfig", a.AdminKubeConfig) + objectMap["computeType"] = ComputeTypeAKS + populate(objectMap, "imagePullSecretName", a.ImagePullSecretName) + populate(objectMap, "userKubeConfig", a.UserKubeConfig) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AksComputeSecrets. +func (a *AksComputeSecrets) 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 "adminKubeConfig": + err = unpopulate(val, &a.AdminKubeConfig) + delete(rawMsg, key) + case "computeType": + err = unpopulate(val, &a.ComputeType) + delete(rawMsg, key) + case "imagePullSecretName": + err = unpopulate(val, &a.ImagePullSecretName) + delete(rawMsg, key) + case "userKubeConfig": + err = unpopulate(val, &a.UserKubeConfig) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetCompute implements the ComputeClassification interface for type AmlCompute. +func (a *AmlCompute) GetCompute() *Compute { + return &Compute{ + ComputeType: a.ComputeType, + ComputeLocation: a.ComputeLocation, + ProvisioningState: a.ProvisioningState, + Description: a.Description, + CreatedOn: a.CreatedOn, + ModifiedOn: a.ModifiedOn, + ResourceID: a.ResourceID, + ProvisioningErrors: a.ProvisioningErrors, + IsAttachedCompute: a.IsAttachedCompute, + DisableLocalAuth: a.DisableLocalAuth, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AmlCompute. +func (a AmlCompute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "computeLocation", a.ComputeLocation) + objectMap["computeType"] = ComputeTypeAmlCompute + populateTimeRFC3339(objectMap, "createdOn", a.CreatedOn) + populate(objectMap, "description", a.Description) + populate(objectMap, "disableLocalAuth", a.DisableLocalAuth) + populate(objectMap, "isAttachedCompute", a.IsAttachedCompute) + populateTimeRFC3339(objectMap, "modifiedOn", a.ModifiedOn) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "provisioningErrors", a.ProvisioningErrors) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "resourceId", a.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AmlCompute. +func (a *AmlCompute) 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 "computeLocation": + err = unpopulate(val, &a.ComputeLocation) + delete(rawMsg, key) + case "computeType": + err = unpopulate(val, &a.ComputeType) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, &a.CreatedOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &a.Description) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, &a.DisableLocalAuth) + delete(rawMsg, key) + case "isAttachedCompute": + err = unpopulate(val, &a.IsAttachedCompute) + delete(rawMsg, key) + case "modifiedOn": + err = unpopulateTimeRFC3339(val, &a.ModifiedOn) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + case "provisioningErrors": + err = unpopulate(val, &a.ProvisioningErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &a.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, &a.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AmlComputeNodesInformation. +func (a AmlComputeNodesInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "nodes", a.Nodes) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AmlComputeProperties. +func (a AmlComputeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allocationState", a.AllocationState) + populateTimeRFC3339(objectMap, "allocationStateTransitionTime", a.AllocationStateTransitionTime) + populate(objectMap, "currentNodeCount", a.CurrentNodeCount) + populate(objectMap, "enableNodePublicIp", a.EnableNodePublicIP) + populate(objectMap, "errors", a.Errors) + populate(objectMap, "isolatedNetwork", a.IsolatedNetwork) + populate(objectMap, "nodeStateCounts", a.NodeStateCounts) + populate(objectMap, "osType", a.OSType) + populate(objectMap, "remoteLoginPortPublicAccess", a.RemoteLoginPortPublicAccess) + populate(objectMap, "scaleSettings", a.ScaleSettings) + populate(objectMap, "subnet", a.Subnet) + populate(objectMap, "targetNodeCount", a.TargetNodeCount) + populate(objectMap, "userAccountCredentials", a.UserAccountCredentials) + populate(objectMap, "vmPriority", a.VMPriority) + populate(objectMap, "vmSize", a.VMSize) + populate(objectMap, "virtualMachineImage", a.VirtualMachineImage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AmlComputeProperties. +func (a *AmlComputeProperties) 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 "allocationState": + err = unpopulate(val, &a.AllocationState) + delete(rawMsg, key) + case "allocationStateTransitionTime": + err = unpopulateTimeRFC3339(val, &a.AllocationStateTransitionTime) + delete(rawMsg, key) + case "currentNodeCount": + err = unpopulate(val, &a.CurrentNodeCount) + delete(rawMsg, key) + case "enableNodePublicIp": + err = unpopulate(val, &a.EnableNodePublicIP) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, &a.Errors) + delete(rawMsg, key) + case "isolatedNetwork": + err = unpopulate(val, &a.IsolatedNetwork) + delete(rawMsg, key) + case "nodeStateCounts": + err = unpopulate(val, &a.NodeStateCounts) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, &a.OSType) + delete(rawMsg, key) + case "remoteLoginPortPublicAccess": + err = unpopulate(val, &a.RemoteLoginPortPublicAccess) + delete(rawMsg, key) + case "scaleSettings": + err = unpopulate(val, &a.ScaleSettings) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, &a.Subnet) + delete(rawMsg, key) + case "targetNodeCount": + err = unpopulate(val, &a.TargetNodeCount) + delete(rawMsg, key) + case "userAccountCredentials": + err = unpopulate(val, &a.UserAccountCredentials) + delete(rawMsg, key) + case "vmPriority": + err = unpopulate(val, &a.VMPriority) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, &a.VMSize) + delete(rawMsg, key) + case "virtualMachineImage": + err = unpopulate(val, &a.VirtualMachineImage) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterUpdateParameters. +func (c ClusterUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Components1D3SwueSchemasComputeresourceAllof1. +func (c Components1D3SwueSchemasComputeresourceAllof1) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Components1D3SwueSchemasComputeresourceAllof1. +func (c *Components1D3SwueSchemasComputeresourceAllof1) 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 = unmarshalComputeClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetCompute implements the ComputeClassification interface for type Compute. +func (c *Compute) GetCompute() *Compute { return c } + +// MarshalJSON implements the json.Marshaller interface for type Compute. +func (c Compute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "computeLocation", c.ComputeLocation) + objectMap["computeType"] = c.ComputeType + populateTimeRFC3339(objectMap, "createdOn", c.CreatedOn) + populate(objectMap, "description", c.Description) + populate(objectMap, "disableLocalAuth", c.DisableLocalAuth) + populate(objectMap, "isAttachedCompute", c.IsAttachedCompute) + populateTimeRFC3339(objectMap, "modifiedOn", c.ModifiedOn) + populate(objectMap, "provisioningErrors", c.ProvisioningErrors) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "resourceId", c.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Compute. +func (c *Compute) 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 "computeLocation": + err = unpopulate(val, &c.ComputeLocation) + delete(rawMsg, key) + case "computeType": + err = unpopulate(val, &c.ComputeType) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, &c.CreatedOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &c.Description) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, &c.DisableLocalAuth) + delete(rawMsg, key) + case "isAttachedCompute": + err = unpopulate(val, &c.IsAttachedCompute) + delete(rawMsg, key) + case "modifiedOn": + err = unpopulateTimeRFC3339(val, &c.ModifiedOn) + delete(rawMsg, key) + case "provisioningErrors": + err = unpopulate(val, &c.ProvisioningErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &c.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, &c.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetCompute implements the ComputeClassification interface for type ComputeInstance. +func (c *ComputeInstance) GetCompute() *Compute { + return &Compute{ + ComputeType: c.ComputeType, + ComputeLocation: c.ComputeLocation, + ProvisioningState: c.ProvisioningState, + Description: c.Description, + CreatedOn: c.CreatedOn, + ModifiedOn: c.ModifiedOn, + ResourceID: c.ResourceID, + ProvisioningErrors: c.ProvisioningErrors, + IsAttachedCompute: c.IsAttachedCompute, + DisableLocalAuth: c.DisableLocalAuth, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ComputeInstance. +func (c ComputeInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "computeLocation", c.ComputeLocation) + objectMap["computeType"] = ComputeTypeComputeInstance + populateTimeRFC3339(objectMap, "createdOn", c.CreatedOn) + populate(objectMap, "description", c.Description) + populate(objectMap, "disableLocalAuth", c.DisableLocalAuth) + populate(objectMap, "isAttachedCompute", c.IsAttachedCompute) + populateTimeRFC3339(objectMap, "modifiedOn", c.ModifiedOn) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "provisioningErrors", c.ProvisioningErrors) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "resourceId", c.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeInstance. +func (c *ComputeInstance) 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 "computeLocation": + err = unpopulate(val, &c.ComputeLocation) + delete(rawMsg, key) + case "computeType": + err = unpopulate(val, &c.ComputeType) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, &c.CreatedOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &c.Description) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, &c.DisableLocalAuth) + delete(rawMsg, key) + case "isAttachedCompute": + err = unpopulate(val, &c.IsAttachedCompute) + delete(rawMsg, key) + case "modifiedOn": + err = unpopulateTimeRFC3339(val, &c.ModifiedOn) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &c.Properties) + delete(rawMsg, key) + case "provisioningErrors": + err = unpopulate(val, &c.ProvisioningErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &c.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, &c.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComputeInstanceLastOperation. +func (c ComputeInstanceLastOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "operationName", c.OperationName) + populate(objectMap, "operationStatus", c.OperationStatus) + populateTimeRFC3339(objectMap, "operationTime", c.OperationTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeInstanceLastOperation. +func (c *ComputeInstanceLastOperation) 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 "operationName": + err = unpopulate(val, &c.OperationName) + delete(rawMsg, key) + case "operationStatus": + err = unpopulate(val, &c.OperationStatus) + delete(rawMsg, key) + case "operationTime": + err = unpopulateTimeRFC3339(val, &c.OperationTime) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComputeInstanceProperties. +func (c ComputeInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applicationSharingPolicy", c.ApplicationSharingPolicy) + populate(objectMap, "applications", c.Applications) + populate(objectMap, "computeInstanceAuthorizationType", c.ComputeInstanceAuthorizationType) + populate(objectMap, "connectivityEndpoints", c.ConnectivityEndpoints) + populate(objectMap, "createdBy", c.CreatedBy) + populate(objectMap, "errors", c.Errors) + populate(objectMap, "lastOperation", c.LastOperation) + populate(objectMap, "personalComputeInstanceSettings", c.PersonalComputeInstanceSettings) + populate(objectMap, "sshSettings", c.SSHSettings) + populate(objectMap, "setupScripts", c.SetupScripts) + populate(objectMap, "state", c.State) + populate(objectMap, "subnet", c.Subnet) + populate(objectMap, "vmSize", c.VMSize) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ComputeResource. +func (c ComputeResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "sku", c.SKU) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeResource. +func (c *ComputeResource) 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 "id": + err = unpopulate(val, &c.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, &c.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &c.Name) + delete(rawMsg, key) + case "properties": + c.Properties, err = unmarshalComputeClassification(val) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, &c.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &c.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetComputeSecrets implements the ComputeSecretsClassification interface for type ComputeSecrets. +func (c *ComputeSecrets) GetComputeSecrets() *ComputeSecrets { return c } + +// GetCompute implements the ComputeClassification interface for type DataFactory. +func (d *DataFactory) GetCompute() *Compute { + return &Compute{ + ComputeType: d.ComputeType, + ComputeLocation: d.ComputeLocation, + ProvisioningState: d.ProvisioningState, + Description: d.Description, + CreatedOn: d.CreatedOn, + ModifiedOn: d.ModifiedOn, + ResourceID: d.ResourceID, + ProvisioningErrors: d.ProvisioningErrors, + IsAttachedCompute: d.IsAttachedCompute, + DisableLocalAuth: d.DisableLocalAuth, + } +} + +// MarshalJSON implements the json.Marshaller interface for type DataFactory. +func (d DataFactory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "computeLocation", d.ComputeLocation) + objectMap["computeType"] = ComputeTypeDataFactory + populateTimeRFC3339(objectMap, "createdOn", d.CreatedOn) + populate(objectMap, "description", d.Description) + populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) + populate(objectMap, "isAttachedCompute", d.IsAttachedCompute) + populateTimeRFC3339(objectMap, "modifiedOn", d.ModifiedOn) + populate(objectMap, "provisioningErrors", d.ProvisioningErrors) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "resourceId", d.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataFactory. +func (d *DataFactory) 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 "computeLocation": + err = unpopulate(val, &d.ComputeLocation) + delete(rawMsg, key) + case "computeType": + err = unpopulate(val, &d.ComputeType) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, &d.CreatedOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &d.Description) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, &d.DisableLocalAuth) + delete(rawMsg, key) + case "isAttachedCompute": + err = unpopulate(val, &d.IsAttachedCompute) + delete(rawMsg, key) + case "modifiedOn": + err = unpopulateTimeRFC3339(val, &d.ModifiedOn) + delete(rawMsg, key) + case "provisioningErrors": + err = unpopulate(val, &d.ProvisioningErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &d.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, &d.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetCompute implements the ComputeClassification interface for type DataLakeAnalytics. +func (d *DataLakeAnalytics) GetCompute() *Compute { + return &Compute{ + ComputeType: d.ComputeType, + ComputeLocation: d.ComputeLocation, + ProvisioningState: d.ProvisioningState, + Description: d.Description, + CreatedOn: d.CreatedOn, + ModifiedOn: d.ModifiedOn, + ResourceID: d.ResourceID, + ProvisioningErrors: d.ProvisioningErrors, + IsAttachedCompute: d.IsAttachedCompute, + DisableLocalAuth: d.DisableLocalAuth, + } +} + +// MarshalJSON implements the json.Marshaller interface for type DataLakeAnalytics. +func (d DataLakeAnalytics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "computeLocation", d.ComputeLocation) + objectMap["computeType"] = ComputeTypeDataLakeAnalytics + populateTimeRFC3339(objectMap, "createdOn", d.CreatedOn) + populate(objectMap, "description", d.Description) + populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) + populate(objectMap, "isAttachedCompute", d.IsAttachedCompute) + populateTimeRFC3339(objectMap, "modifiedOn", d.ModifiedOn) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "provisioningErrors", d.ProvisioningErrors) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "resourceId", d.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataLakeAnalytics. +func (d *DataLakeAnalytics) 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 "computeLocation": + err = unpopulate(val, &d.ComputeLocation) + delete(rawMsg, key) + case "computeType": + err = unpopulate(val, &d.ComputeType) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, &d.CreatedOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &d.Description) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, &d.DisableLocalAuth) + delete(rawMsg, key) + case "isAttachedCompute": + err = unpopulate(val, &d.IsAttachedCompute) + delete(rawMsg, key) + case "modifiedOn": + err = unpopulateTimeRFC3339(val, &d.ModifiedOn) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &d.Properties) + delete(rawMsg, key) + case "provisioningErrors": + err = unpopulate(val, &d.ProvisioningErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &d.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, &d.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetCompute implements the ComputeClassification interface for type Databricks. +func (d *Databricks) GetCompute() *Compute { + return &Compute{ + ComputeType: d.ComputeType, + ComputeLocation: d.ComputeLocation, + ProvisioningState: d.ProvisioningState, + Description: d.Description, + CreatedOn: d.CreatedOn, + ModifiedOn: d.ModifiedOn, + ResourceID: d.ResourceID, + ProvisioningErrors: d.ProvisioningErrors, + IsAttachedCompute: d.IsAttachedCompute, + DisableLocalAuth: d.DisableLocalAuth, + } +} + +// MarshalJSON implements the json.Marshaller interface for type Databricks. +func (d Databricks) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "computeLocation", d.ComputeLocation) + objectMap["computeType"] = ComputeTypeDatabricks + populateTimeRFC3339(objectMap, "createdOn", d.CreatedOn) + populate(objectMap, "description", d.Description) + populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) + populate(objectMap, "isAttachedCompute", d.IsAttachedCompute) + populateTimeRFC3339(objectMap, "modifiedOn", d.ModifiedOn) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "provisioningErrors", d.ProvisioningErrors) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "resourceId", d.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Databricks. +func (d *Databricks) 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 "computeLocation": + err = unpopulate(val, &d.ComputeLocation) + delete(rawMsg, key) + case "computeType": + err = unpopulate(val, &d.ComputeType) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, &d.CreatedOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &d.Description) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, &d.DisableLocalAuth) + delete(rawMsg, key) + case "isAttachedCompute": + err = unpopulate(val, &d.IsAttachedCompute) + delete(rawMsg, key) + case "modifiedOn": + err = unpopulateTimeRFC3339(val, &d.ModifiedOn) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &d.Properties) + delete(rawMsg, key) + case "provisioningErrors": + err = unpopulate(val, &d.ProvisioningErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &d.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, &d.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetComputeSecrets implements the ComputeSecretsClassification interface for type DatabricksComputeSecrets. +func (d *DatabricksComputeSecrets) GetComputeSecrets() *ComputeSecrets { + return &ComputeSecrets{ + ComputeType: d.ComputeType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type DatabricksComputeSecrets. +func (d DatabricksComputeSecrets) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["computeType"] = ComputeTypeDatabricks + populate(objectMap, "databricksAccessToken", d.DatabricksAccessToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabricksComputeSecrets. +func (d *DatabricksComputeSecrets) 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 "computeType": + err = unpopulate(val, &d.ComputeType) + delete(rawMsg, key) + case "databricksAccessToken": + err = unpopulate(val, &d.DatabricksAccessToken) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnoseRequestProperties. +func (d DiagnoseRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applicationInsights", d.ApplicationInsights) + populate(objectMap, "containerRegistry", d.ContainerRegistry) + populate(objectMap, "dnsResolution", d.DNSResolution) + populate(objectMap, "keyVault", d.KeyVault) + populate(objectMap, "nsg", d.Nsg) + populate(objectMap, "others", d.Others) + populate(objectMap, "resourceLock", d.ResourceLock) + populate(objectMap, "storageAccount", d.StorageAccount) + populate(objectMap, "udr", d.Udr) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnoseResponseResultValue. +func (d DiagnoseResponseResultValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applicationInsightsResults", d.ApplicationInsightsResults) + populate(objectMap, "containerRegistryResults", d.ContainerRegistryResults) + populate(objectMap, "dnsResolutionResults", d.DNSResolutionResults) + populate(objectMap, "keyVaultResults", d.KeyVaultResults) + populate(objectMap, "networkSecurityRuleResults", d.NetworkSecurityRuleResults) + populate(objectMap, "otherResults", d.OtherResults) + populate(objectMap, "resourceLockResults", d.ResourceLockResults) + populate(objectMap, "storageAccountResults", d.StorageAccountResults) + populate(objectMap, "userDefinedRouteResults", d.UserDefinedRouteResults) + return json.Marshal(objectMap) +} + +// 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) +} + +// MarshalJSON implements the json.Marshaller interface for type EstimatedVMPrices. +func (e EstimatedVMPrices) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingCurrency", e.BillingCurrency) + populate(objectMap, "unitOfMeasure", e.UnitOfMeasure) + populate(objectMap, "values", e.Values) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ExternalFQDNResponse. +func (e ExternalFQDNResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type FQDNEndpoint. +func (f FQDNEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "domainName", f.DomainName) + populate(objectMap, "endpointDetails", f.EndpointDetails) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type FQDNEndpointsProperties. +func (f FQDNEndpointsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "category", f.Category) + populate(objectMap, "endpoints", f.Endpoints) + return json.Marshal(objectMap) +} + +// GetCompute implements the ComputeClassification interface for type HDInsight. +func (h *HDInsight) GetCompute() *Compute { + return &Compute{ + ComputeType: h.ComputeType, + ComputeLocation: h.ComputeLocation, + ProvisioningState: h.ProvisioningState, + Description: h.Description, + CreatedOn: h.CreatedOn, + ModifiedOn: h.ModifiedOn, + ResourceID: h.ResourceID, + ProvisioningErrors: h.ProvisioningErrors, + IsAttachedCompute: h.IsAttachedCompute, + DisableLocalAuth: h.DisableLocalAuth, + } +} + +// MarshalJSON implements the json.Marshaller interface for type HDInsight. +func (h HDInsight) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "computeLocation", h.ComputeLocation) + objectMap["computeType"] = ComputeTypeHDInsight + populateTimeRFC3339(objectMap, "createdOn", h.CreatedOn) + populate(objectMap, "description", h.Description) + populate(objectMap, "disableLocalAuth", h.DisableLocalAuth) + populate(objectMap, "isAttachedCompute", h.IsAttachedCompute) + populateTimeRFC3339(objectMap, "modifiedOn", h.ModifiedOn) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "provisioningErrors", h.ProvisioningErrors) + populate(objectMap, "provisioningState", h.ProvisioningState) + populate(objectMap, "resourceId", h.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HDInsight. +func (h *HDInsight) 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 "computeLocation": + err = unpopulate(val, &h.ComputeLocation) + delete(rawMsg, key) + case "computeType": + err = unpopulate(val, &h.ComputeType) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, &h.CreatedOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &h.Description) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, &h.DisableLocalAuth) + delete(rawMsg, key) + case "isAttachedCompute": + err = unpopulate(val, &h.IsAttachedCompute) + delete(rawMsg, key) + case "modifiedOn": + err = unpopulateTimeRFC3339(val, &h.ModifiedOn) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &h.Properties) + delete(rawMsg, key) + case "provisioningErrors": + err = unpopulate(val, &h.ProvisioningErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &h.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, &h.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type InstanceTypeSchema. +func (i InstanceTypeSchema) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nodeSelector", i.NodeSelector) + populate(objectMap, "resources", i.Resources) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type InstanceTypeSchemaResources. +func (i InstanceTypeSchemaResources) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "limits", i.Limits) + populate(objectMap, "requests", i.Requests) + return json.Marshal(objectMap) +} + +// GetCompute implements the ComputeClassification interface for type Kubernetes. +func (k *Kubernetes) GetCompute() *Compute { + return &Compute{ + ComputeType: k.ComputeType, + ComputeLocation: k.ComputeLocation, + ProvisioningState: k.ProvisioningState, + Description: k.Description, + CreatedOn: k.CreatedOn, + ModifiedOn: k.ModifiedOn, + ResourceID: k.ResourceID, + ProvisioningErrors: k.ProvisioningErrors, + IsAttachedCompute: k.IsAttachedCompute, + DisableLocalAuth: k.DisableLocalAuth, + } +} + +// MarshalJSON implements the json.Marshaller interface for type Kubernetes. +func (k Kubernetes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "computeLocation", k.ComputeLocation) + objectMap["computeType"] = ComputeTypeKubernetes + populateTimeRFC3339(objectMap, "createdOn", k.CreatedOn) + populate(objectMap, "description", k.Description) + populate(objectMap, "disableLocalAuth", k.DisableLocalAuth) + populate(objectMap, "isAttachedCompute", k.IsAttachedCompute) + populateTimeRFC3339(objectMap, "modifiedOn", k.ModifiedOn) + populate(objectMap, "properties", k.Properties) + populate(objectMap, "provisioningErrors", k.ProvisioningErrors) + populate(objectMap, "provisioningState", k.ProvisioningState) + populate(objectMap, "resourceId", k.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Kubernetes. +func (k *Kubernetes) 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 "computeLocation": + err = unpopulate(val, &k.ComputeLocation) + delete(rawMsg, key) + case "computeType": + err = unpopulate(val, &k.ComputeType) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, &k.CreatedOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &k.Description) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, &k.DisableLocalAuth) + delete(rawMsg, key) + case "isAttachedCompute": + err = unpopulate(val, &k.IsAttachedCompute) + delete(rawMsg, key) + case "modifiedOn": + err = unpopulateTimeRFC3339(val, &k.ModifiedOn) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &k.Properties) + delete(rawMsg, key) + case "provisioningErrors": + err = unpopulate(val, &k.ProvisioningErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &k.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, &k.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesProperties. +func (k KubernetesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultInstanceType", k.DefaultInstanceType) + populate(objectMap, "extensionInstanceReleaseTrain", k.ExtensionInstanceReleaseTrain) + populate(objectMap, "extensionPrincipalId", k.ExtensionPrincipalID) + populate(objectMap, "instanceTypes", k.InstanceTypes) + populate(objectMap, "namespace", k.Namespace) + populate(objectMap, "relayConnectionString", k.RelayConnectionString) + populate(objectMap, "serviceBusConnectionString", k.ServiceBusConnectionString) + populate(objectMap, "vcName", k.VcName) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ListAmlUserFeatureResult. +func (l ListAmlUserFeatureResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ListUsagesResult. +func (l ListUsagesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ListWorkspaceQuotas. +func (l ListWorkspaceQuotas) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PaginatedComputeResourcesList. +func (p PaginatedComputeResourcesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PaginatedWorkspaceConnectionsList. +func (p PaginatedWorkspaceConnectionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "identity", p.Identity) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "sku", p.SKU) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "identity", p.Identity) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "sku", p.SKU) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaUpdateParameters. +func (q QuotaUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", q.Location) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RegistryListCredentialsResult. +func (r RegistryListCredentialsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", r.Location) + populate(objectMap, "passwords", r.Passwords) + populate(objectMap, "username", r.Username) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKULocationInfo. +func (r ResourceSKULocationInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", r.Location) + populate(objectMap, "zoneDetails", r.ZoneDetails) + populate(objectMap, "zones", r.Zones) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKUZoneDetails. +func (r ResourceSKUZoneDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capabilities", r.Capabilities) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Restriction. +func (r Restriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "reasonCode", r.ReasonCode) + populate(objectMap, "type", r.Type) + populate(objectMap, "values", r.Values) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type SKUListResult. +func (s SKUListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// GetCompute implements the ComputeClassification interface for type SynapseSpark. +func (s *SynapseSpark) GetCompute() *Compute { + return &Compute{ + ComputeType: s.ComputeType, + ComputeLocation: s.ComputeLocation, + ProvisioningState: s.ProvisioningState, + Description: s.Description, + CreatedOn: s.CreatedOn, + ModifiedOn: s.ModifiedOn, + ResourceID: s.ResourceID, + ProvisioningErrors: s.ProvisioningErrors, + IsAttachedCompute: s.IsAttachedCompute, + DisableLocalAuth: s.DisableLocalAuth, + } +} + +// MarshalJSON implements the json.Marshaller interface for type SynapseSpark. +func (s SynapseSpark) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "computeLocation", s.ComputeLocation) + objectMap["computeType"] = ComputeTypeSynapseSpark + populateTimeRFC3339(objectMap, "createdOn", s.CreatedOn) + populate(objectMap, "description", s.Description) + populate(objectMap, "disableLocalAuth", s.DisableLocalAuth) + populate(objectMap, "isAttachedCompute", s.IsAttachedCompute) + populateTimeRFC3339(objectMap, "modifiedOn", s.ModifiedOn) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "provisioningErrors", s.ProvisioningErrors) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "resourceId", s.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SynapseSpark. +func (s *SynapseSpark) 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 "computeLocation": + err = unpopulate(val, &s.ComputeLocation) + delete(rawMsg, key) + case "computeType": + err = unpopulate(val, &s.ComputeType) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, &s.CreatedOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &s.Description) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, &s.DisableLocalAuth) + delete(rawMsg, key) + case "isAttachedCompute": + err = unpopulate(val, &s.IsAttachedCompute) + delete(rawMsg, key) + case "modifiedOn": + err = unpopulateTimeRFC3339(val, &s.ModifiedOn) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &s.Properties) + delete(rawMsg, key) + case "provisioningErrors": + err = unpopulate(val, &s.ProvisioningErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &s.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, &s.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// 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 +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateWorkspaceQuotasResult. +func (u UpdateWorkspaceQuotasResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// GetCompute implements the ComputeClassification interface for type VirtualMachine. +func (v *VirtualMachine) GetCompute() *Compute { + return &Compute{ + ComputeType: v.ComputeType, + ComputeLocation: v.ComputeLocation, + ProvisioningState: v.ProvisioningState, + Description: v.Description, + CreatedOn: v.CreatedOn, + ModifiedOn: v.ModifiedOn, + ResourceID: v.ResourceID, + ProvisioningErrors: v.ProvisioningErrors, + IsAttachedCompute: v.IsAttachedCompute, + DisableLocalAuth: v.DisableLocalAuth, + } +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachine. +func (v VirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "computeLocation", v.ComputeLocation) + objectMap["computeType"] = ComputeTypeVirtualMachine + populateTimeRFC3339(objectMap, "createdOn", v.CreatedOn) + populate(objectMap, "description", v.Description) + populate(objectMap, "disableLocalAuth", v.DisableLocalAuth) + populate(objectMap, "isAttachedCompute", v.IsAttachedCompute) + populateTimeRFC3339(objectMap, "modifiedOn", v.ModifiedOn) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "provisioningErrors", v.ProvisioningErrors) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "resourceId", v.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachine. +func (v *VirtualMachine) 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 "computeLocation": + err = unpopulate(val, &v.ComputeLocation) + delete(rawMsg, key) + case "computeType": + err = unpopulate(val, &v.ComputeType) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, &v.CreatedOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &v.Description) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, &v.DisableLocalAuth) + delete(rawMsg, key) + case "isAttachedCompute": + err = unpopulate(val, &v.IsAttachedCompute) + delete(rawMsg, key) + case "modifiedOn": + err = unpopulateTimeRFC3339(val, &v.ModifiedOn) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &v.Properties) + delete(rawMsg, key) + case "provisioningErrors": + err = unpopulate(val, &v.ProvisioningErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &v.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, &v.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetComputeSecrets implements the ComputeSecretsClassification interface for type VirtualMachineSecrets. +func (v *VirtualMachineSecrets) GetComputeSecrets() *ComputeSecrets { + return &ComputeSecrets{ + ComputeType: v.ComputeType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineSecrets. +func (v VirtualMachineSecrets) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "administratorAccount", v.AdministratorAccount) + objectMap["computeType"] = ComputeTypeVirtualMachine + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineSecrets. +func (v *VirtualMachineSecrets) 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 "administratorAccount": + err = unpopulate(val, &v.AdministratorAccount) + delete(rawMsg, key) + case "computeType": + err = unpopulate(val, &v.ComputeType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineSize. +func (v VirtualMachineSize) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "estimatedVMPrices", v.EstimatedVMPrices) + populate(objectMap, "family", v.Family) + populate(objectMap, "gpus", v.Gpus) + populate(objectMap, "lowPriorityCapable", v.LowPriorityCapable) + populate(objectMap, "maxResourceVolumeMB", v.MaxResourceVolumeMB) + populate(objectMap, "memoryGB", v.MemoryGB) + populate(objectMap, "name", v.Name) + populate(objectMap, "osVhdSizeMB", v.OSVhdSizeMB) + populate(objectMap, "premiumIO", v.PremiumIO) + populate(objectMap, "supportedComputeTypes", v.SupportedComputeTypes) + populate(objectMap, "vCPUs", v.VCPUs) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineSizeListResult. +func (v VirtualMachineSizeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Workspace. +func (w Workspace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "identity", w.Identity) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "sku", w.SKU) + populate(objectMap, "systemData", w.SystemData) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type WorkspaceListResult. +func (w WorkspaceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type WorkspaceProperties. +func (w WorkspaceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowPublicAccessWhenBehindVnet", w.AllowPublicAccessWhenBehindVnet) + populate(objectMap, "applicationInsights", w.ApplicationInsights) + populate(objectMap, "containerRegistry", w.ContainerRegistry) + populate(objectMap, "description", w.Description) + populate(objectMap, "discoveryUrl", w.DiscoveryURL) + populate(objectMap, "encryption", w.Encryption) + populate(objectMap, "friendlyName", w.FriendlyName) + populate(objectMap, "hbiWorkspace", w.HbiWorkspace) + populate(objectMap, "imageBuildCompute", w.ImageBuildCompute) + populate(objectMap, "keyVault", w.KeyVault) + populate(objectMap, "mlFlowTrackingUri", w.MlFlowTrackingURI) + populate(objectMap, "notebookInfo", w.NotebookInfo) + populate(objectMap, "primaryUserAssignedIdentity", w.PrimaryUserAssignedIdentity) + populate(objectMap, "privateEndpointConnections", w.PrivateEndpointConnections) + populate(objectMap, "privateLinkCount", w.PrivateLinkCount) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "publicNetworkAccess", w.PublicNetworkAccess) + populate(objectMap, "serviceManagedResourcesSettings", w.ServiceManagedResourcesSettings) + populate(objectMap, "serviceProvisionedResourceGroup", w.ServiceProvisionedResourceGroup) + populate(objectMap, "sharedPrivateLinkResources", w.SharedPrivateLinkResources) + populate(objectMap, "storageAccount", w.StorageAccount) + populate(objectMap, "storageHnsEnabled", w.StorageHnsEnabled) + populate(objectMap, "tenantId", w.TenantID) + populate(objectMap, "workspaceId", w.WorkspaceID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type WorkspaceSKU. +func (w WorkspaceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capabilities", w.Capabilities) + populate(objectMap, "locationInfo", w.LocationInfo) + populate(objectMap, "locations", w.Locations) + populate(objectMap, "name", w.Name) + populate(objectMap, "resourceType", w.ResourceType) + populate(objectMap, "restrictions", w.Restrictions) + populate(objectMap, "tier", w.Tier) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type WorkspaceUpdateParameters. +func (w WorkspaceUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", w.Identity) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "sku", w.SKU) + populate(objectMap, "tags", w.Tags) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_operations_client.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_operations_client.go index 002b3a0c55f5..e5422f8294c4 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_operations_client.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,37 +29,48 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Lists all of the available Azure Machine Learning Workspaces REST API operations. // If the operation fails it returns an *azcore.ResponseError type. // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(ctx context.Context, options *OperationsClientListOptions) (OperationsClientListResponse, error) { - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return OperationsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return OperationsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *OperationsClient) List(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -77,7 +89,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_pagers.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_pagers.go deleted file mode 100644 index c2667c025a25..000000000000 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_pagers.go +++ /dev/null @@ -1,449 +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 armmachinelearningservices - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// ComputeClientListNodesPager provides operations for iterating over paged responses. -type ComputeClientListNodesPager struct { - client *ComputeClient - current ComputeClientListNodesResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ComputeClientListNodesResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ComputeClientListNodesPager) 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 *ComputeClientListNodesPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.AmlComputeNodesInformation.NextLink == nil || len(*p.current.AmlComputeNodesInformation.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listNodesHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ComputeClientListNodesResponse page. -func (p *ComputeClientListNodesPager) PageResponse() ComputeClientListNodesResponse { - return p.current -} - -// ComputeClientListPager provides operations for iterating over paged responses. -type ComputeClientListPager struct { - client *ComputeClient - current ComputeClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ComputeClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ComputeClientListPager) 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 *ComputeClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PaginatedComputeResourcesList.NextLink == nil || len(*p.current.PaginatedComputeResourcesList.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 = runtime.NewResponseError(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 ComputeClientListResponse page. -func (p *ComputeClientListPager) PageResponse() ComputeClientListResponse { - return p.current -} - -// QuotasClientListPager provides operations for iterating over paged responses. -type QuotasClientListPager struct { - client *QuotasClient - current QuotasClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, QuotasClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *QuotasClientListPager) 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 *QuotasClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ListWorkspaceQuotas.NextLink == nil || len(*p.current.ListWorkspaceQuotas.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 = runtime.NewResponseError(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 QuotasClientListResponse page. -func (p *QuotasClientListPager) PageResponse() QuotasClientListResponse { - return p.current -} - -// UsagesClientListPager provides operations for iterating over paged responses. -type UsagesClientListPager struct { - client *UsagesClient - current UsagesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, UsagesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *UsagesClientListPager) 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 *UsagesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ListUsagesResult.NextLink == nil || len(*p.current.ListUsagesResult.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 = runtime.NewResponseError(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 UsagesClientListResponse page. -func (p *UsagesClientListPager) PageResponse() UsagesClientListResponse { - return p.current -} - -// WorkspaceFeaturesClientListPager provides operations for iterating over paged responses. -type WorkspaceFeaturesClientListPager struct { - client *WorkspaceFeaturesClient - current WorkspaceFeaturesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, WorkspaceFeaturesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *WorkspaceFeaturesClientListPager) 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 *WorkspaceFeaturesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ListAmlUserFeatureResult.NextLink == nil || len(*p.current.ListAmlUserFeatureResult.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 = runtime.NewResponseError(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 WorkspaceFeaturesClientListResponse page. -func (p *WorkspaceFeaturesClientListPager) PageResponse() WorkspaceFeaturesClientListResponse { - return p.current -} - -// WorkspaceSKUsClientListPager provides operations for iterating over paged responses. -type WorkspaceSKUsClientListPager struct { - client *WorkspaceSKUsClient - current WorkspaceSKUsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, WorkspaceSKUsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *WorkspaceSKUsClientListPager) 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 *WorkspaceSKUsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.SKUListResult.NextLink == nil || len(*p.current.SKUListResult.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 = runtime.NewResponseError(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 WorkspaceSKUsClientListResponse page. -func (p *WorkspaceSKUsClientListPager) PageResponse() WorkspaceSKUsClientListResponse { - return p.current -} - -// WorkspacesClientListByResourceGroupPager provides operations for iterating over paged responses. -type WorkspacesClientListByResourceGroupPager struct { - client *WorkspacesClient - current WorkspacesClientListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, WorkspacesClientListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *WorkspacesClientListByResourceGroupPager) 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 *WorkspacesClientListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.WorkspaceListResult.NextLink == nil || len(*p.current.WorkspaceListResult.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 = runtime.NewResponseError(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 WorkspacesClientListByResourceGroupResponse page. -func (p *WorkspacesClientListByResourceGroupPager) PageResponse() WorkspacesClientListByResourceGroupResponse { - return p.current -} - -// WorkspacesClientListBySubscriptionPager provides operations for iterating over paged responses. -type WorkspacesClientListBySubscriptionPager struct { - client *WorkspacesClient - current WorkspacesClientListBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, WorkspacesClientListBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *WorkspacesClientListBySubscriptionPager) 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 *WorkspacesClientListBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.WorkspaceListResult.NextLink == nil || len(*p.current.WorkspaceListResult.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 = runtime.NewResponseError(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 WorkspacesClientListBySubscriptionResponse page. -func (p *WorkspacesClientListBySubscriptionPager) PageResponse() WorkspacesClientListBySubscriptionResponse { - return p.current -} diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_pollers.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_pollers.go deleted file mode 100644 index 17337192a921..000000000000 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_pollers.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 armmachinelearningservices - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// ComputeClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type ComputeClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ComputeClientCreateOrUpdatePoller) 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 *ComputeClientCreateOrUpdatePoller) 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 ComputeClientCreateOrUpdateResponse will be returned. -func (p *ComputeClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (ComputeClientCreateOrUpdateResponse, error) { - respType := ComputeClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ComputeResource) - if err != nil { - return ComputeClientCreateOrUpdateResponse{}, 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 *ComputeClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ComputeClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type ComputeClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ComputeClientDeletePoller) 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 *ComputeClientDeletePoller) 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 ComputeClientDeleteResponse will be returned. -func (p *ComputeClientDeletePoller) FinalResponse(ctx context.Context) (ComputeClientDeleteResponse, error) { - respType := ComputeClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return ComputeClientDeleteResponse{}, 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 *ComputeClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ComputeClientRestartPoller provides polling facilities until the operation reaches a terminal state. -type ComputeClientRestartPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ComputeClientRestartPoller) 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 *ComputeClientRestartPoller) 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 ComputeClientRestartResponse will be returned. -func (p *ComputeClientRestartPoller) FinalResponse(ctx context.Context) (ComputeClientRestartResponse, error) { - respType := ComputeClientRestartResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return ComputeClientRestartResponse{}, 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 *ComputeClientRestartPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ComputeClientStartPoller provides polling facilities until the operation reaches a terminal state. -type ComputeClientStartPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ComputeClientStartPoller) 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 *ComputeClientStartPoller) 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 ComputeClientStartResponse will be returned. -func (p *ComputeClientStartPoller) FinalResponse(ctx context.Context) (ComputeClientStartResponse, error) { - respType := ComputeClientStartResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return ComputeClientStartResponse{}, 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 *ComputeClientStartPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ComputeClientStopPoller provides polling facilities until the operation reaches a terminal state. -type ComputeClientStopPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ComputeClientStopPoller) 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 *ComputeClientStopPoller) 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 ComputeClientStopResponse will be returned. -func (p *ComputeClientStopPoller) FinalResponse(ctx context.Context) (ComputeClientStopResponse, error) { - respType := ComputeClientStopResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return ComputeClientStopResponse{}, 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 *ComputeClientStopPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ComputeClientUpdatePoller provides polling facilities until the operation reaches a terminal state. -type ComputeClientUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ComputeClientUpdatePoller) 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 *ComputeClientUpdatePoller) 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 ComputeClientUpdateResponse will be returned. -func (p *ComputeClientUpdatePoller) FinalResponse(ctx context.Context) (ComputeClientUpdateResponse, error) { - respType := ComputeClientUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ComputeResource) - if err != nil { - return ComputeClientUpdateResponse{}, 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 *ComputeClientUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// WorkspacesClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type WorkspacesClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *WorkspacesClientCreateOrUpdatePoller) 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 *WorkspacesClientCreateOrUpdatePoller) 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 WorkspacesClientCreateOrUpdateResponse will be returned. -func (p *WorkspacesClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (WorkspacesClientCreateOrUpdateResponse, error) { - respType := WorkspacesClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.Workspace) - if err != nil { - return WorkspacesClientCreateOrUpdateResponse{}, 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 *WorkspacesClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// WorkspacesClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type WorkspacesClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *WorkspacesClientDeletePoller) 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 *WorkspacesClientDeletePoller) 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 WorkspacesClientDeleteResponse will be returned. -func (p *WorkspacesClientDeletePoller) FinalResponse(ctx context.Context) (WorkspacesClientDeleteResponse, error) { - respType := WorkspacesClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return WorkspacesClientDeleteResponse{}, 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 *WorkspacesClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// WorkspacesClientDiagnosePoller provides polling facilities until the operation reaches a terminal state. -type WorkspacesClientDiagnosePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *WorkspacesClientDiagnosePoller) 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 *WorkspacesClientDiagnosePoller) 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 WorkspacesClientDiagnoseResponse will be returned. -func (p *WorkspacesClientDiagnosePoller) FinalResponse(ctx context.Context) (WorkspacesClientDiagnoseResponse, error) { - respType := WorkspacesClientDiagnoseResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.DiagnoseResponseResult) - if err != nil { - return WorkspacesClientDiagnoseResponse{}, 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 *WorkspacesClientDiagnosePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// WorkspacesClientPrepareNotebookPoller provides polling facilities until the operation reaches a terminal state. -type WorkspacesClientPrepareNotebookPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *WorkspacesClientPrepareNotebookPoller) 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 *WorkspacesClientPrepareNotebookPoller) 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 WorkspacesClientPrepareNotebookResponse will be returned. -func (p *WorkspacesClientPrepareNotebookPoller) FinalResponse(ctx context.Context) (WorkspacesClientPrepareNotebookResponse, error) { - respType := WorkspacesClientPrepareNotebookResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.NotebookResourceInfo) - if err != nil { - return WorkspacesClientPrepareNotebookResponse{}, 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 *WorkspacesClientPrepareNotebookPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// WorkspacesClientResyncKeysPoller provides polling facilities until the operation reaches a terminal state. -type WorkspacesClientResyncKeysPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *WorkspacesClientResyncKeysPoller) 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 *WorkspacesClientResyncKeysPoller) 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 WorkspacesClientResyncKeysResponse will be returned. -func (p *WorkspacesClientResyncKeysPoller) FinalResponse(ctx context.Context) (WorkspacesClientResyncKeysResponse, error) { - respType := WorkspacesClientResyncKeysResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return WorkspacesClientResyncKeysResponse{}, 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 *WorkspacesClientResyncKeysPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_polymorphic_helpers.go index 99ac7bbfdc38..c364b418a656 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_polymorphic_helpers.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_privateendpointconnections_client.go index 7e6c26f5e149..2ec91acd610b 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_privateendpointconnections_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type PrivateEndpointConnectionsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateEndpointConnectionsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Update the state of specified private endpoint connection associated with the workspace. @@ -104,7 +109,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *PrivateEndpointConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error) { - result := PrivateEndpointConnectionsClientCreateOrUpdateResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { return PrivateEndpointConnectionsClientCreateOrUpdateResponse{}, err } @@ -130,7 +135,7 @@ func (client *PrivateEndpointConnectionsClient) Delete(ctx context.Context, reso if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return PrivateEndpointConnectionsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return PrivateEndpointConnectionsClientDeleteResponse{RawResponse: resp}, nil + return PrivateEndpointConnectionsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -217,7 +222,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con // getHandleResponse handles the Get response. func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { - result := PrivateEndpointConnectionsClientGetResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } @@ -230,19 +235,26 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // workspaceName - Name of Azure Machine Learning workspace. // options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List // method. -func (client *PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, options *PrivateEndpointConnectionsClientListOptions) (PrivateEndpointConnectionsClientListResponse, error) { - req, err := client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) - if err != nil { - return PrivateEndpointConnectionsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PrivateEndpointConnectionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *PrivateEndpointConnectionsClient) List(resourceGroupName string, workspaceName string, options *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[PrivateEndpointConnectionsClientListResponse]{ + More: func(page PrivateEndpointConnectionsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListResponse) (PrivateEndpointConnectionsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -273,7 +285,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co // listHandleResponse handles the List response. func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListResponse, error) { - result := PrivateEndpointConnectionsClientListResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { return PrivateEndpointConnectionsClientListResponse{}, err } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_privatelinkresources_client.go index 09c470fd3e28..9405882c8bd6 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_privatelinkresources_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type PrivateLinkResourcesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateLinkResourcesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Gets the private link resources that need to be created for a workspace. @@ -98,7 +103,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, // listHandleResponse handles the List response. func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListResponse, error) { - result := PrivateLinkResourcesClientListResponse{RawResponse: resp} + result := PrivateLinkResourcesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { return PrivateLinkResourcesClientListResponse{}, err } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_quotas_client.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_quotas_client.go index 7329f5699e90..e21cdf20cbfa 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_quotas_client.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_quotas_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,36 +34,56 @@ type QuotasClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewQuotasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *QuotasClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewQuotasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*QuotasClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &QuotasClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Gets the currently assigned Workspace Quotas based on VMFamily. // If the operation fails it returns an *azcore.ResponseError type. // location - The location for which resource usage is queried. // options - QuotasClientListOptions contains the optional parameters for the QuotasClient.List method. -func (client *QuotasClient) List(location string, options *QuotasClientListOptions) *QuotasClientListPager { - return &QuotasClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, location, options) +func (client *QuotasClient) List(location string, options *QuotasClientListOptions) *runtime.Pager[QuotasClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[QuotasClientListResponse]{ + More: func(page QuotasClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp QuotasClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ListWorkspaceQuotas.NextLink) + Fetcher: func(ctx context.Context, page *QuotasClientListResponse) (QuotasClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return QuotasClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return QuotasClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return QuotasClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -89,7 +110,7 @@ func (client *QuotasClient) listCreateRequest(ctx context.Context, location stri // listHandleResponse handles the List response. func (client *QuotasClient) listHandleResponse(resp *http.Response) (QuotasClientListResponse, error) { - result := QuotasClientListResponse{RawResponse: resp} + result := QuotasClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListWorkspaceQuotas); err != nil { return QuotasClientListResponse{}, err } @@ -140,7 +161,7 @@ func (client *QuotasClient) updateCreateRequest(ctx context.Context, location st // updateHandleResponse handles the Update response. func (client *QuotasClient) updateHandleResponse(resp *http.Response) (QuotasClientUpdateResponse, error) { - result := QuotasClientUpdateResponse{RawResponse: resp} + result := QuotasClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.UpdateWorkspaceQuotasResult); err != nil { return QuotasClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_response_types.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_response_types.go index 3e7cadd81eeb..c40d0aaeecd2 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_response_types.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,137 +8,28 @@ package armmachinelearningservices -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - -// ComputeClientCreateOrUpdatePollerResponse contains the response from method ComputeClient.CreateOrUpdate. -type ComputeClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *ComputeClientCreateOrUpdatePoller - - // 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 ComputeClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ComputeClientCreateOrUpdateResponse, error) { - respType := ComputeClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ComputeResource) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ComputeClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *ComputeClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ComputeClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ComputeClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &ComputeClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ComputeClientCreateOrUpdateResponse contains the response from method ComputeClient.CreateOrUpdate. type ComputeClientCreateOrUpdateResponse struct { - ComputeClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ComputeClientCreateOrUpdateResult contains the result from method ComputeClient.CreateOrUpdate. -type ComputeClientCreateOrUpdateResult struct { ComputeResource } -// ComputeClientDeletePollerResponse contains the response from method ComputeClient.Delete. -type ComputeClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *ComputeClientDeletePoller - - // 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 ComputeClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ComputeClientDeleteResponse, error) { - respType := ComputeClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ComputeClientDeletePollerResponse from the provided client and resume token. -func (l *ComputeClientDeletePollerResponse) Resume(ctx context.Context, client *ComputeClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ComputeClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &ComputeClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ComputeClientDeleteResponse contains the response from method ComputeClient.Delete. type ComputeClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // ComputeClientGetResponse contains the response from method ComputeClient.Get. type ComputeClientGetResponse struct { - ComputeClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ComputeClientGetResult contains the result from method ComputeClient.Get. -type ComputeClientGetResult struct { ComputeResource } // ComputeClientListKeysResponse contains the response from method ComputeClient.ListKeys. type ComputeClientListKeysResponse struct { - ComputeClientListKeysResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ComputeClientListKeysResult contains the result from method ComputeClient.ListKeys. -type ComputeClientListKeysResult struct { ComputeSecretsClassification } -// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeClientListKeysResult. -func (c *ComputeClientListKeysResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeClientListKeysResponse. +func (c *ComputeClientListKeysResponse) UnmarshalJSON(data []byte) error { res, err := unmarshalComputeSecretsClassification(data) if err != nil { return err @@ -149,750 +40,180 @@ func (c *ComputeClientListKeysResult) UnmarshalJSON(data []byte) error { // ComputeClientListNodesResponse contains the response from method ComputeClient.ListNodes. type ComputeClientListNodesResponse struct { - ComputeClientListNodesResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ComputeClientListNodesResult contains the result from method ComputeClient.ListNodes. -type ComputeClientListNodesResult struct { AmlComputeNodesInformation } // ComputeClientListResponse contains the response from method ComputeClient.List. type ComputeClientListResponse struct { - ComputeClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ComputeClientListResult contains the result from method ComputeClient.List. -type ComputeClientListResult struct { PaginatedComputeResourcesList } -// ComputeClientRestartPollerResponse contains the response from method ComputeClient.Restart. -type ComputeClientRestartPollerResponse struct { - // Poller contains an initialized poller. - Poller *ComputeClientRestartPoller - - // 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 ComputeClientRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ComputeClientRestartResponse, error) { - respType := ComputeClientRestartResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ComputeClientRestartPollerResponse from the provided client and resume token. -func (l *ComputeClientRestartPollerResponse) Resume(ctx context.Context, client *ComputeClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ComputeClient.Restart", token, client.pl) - if err != nil { - return err - } - poller := &ComputeClientRestartPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ComputeClientRestartResponse contains the response from method ComputeClient.Restart. type ComputeClientRestartResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ComputeClientStartPollerResponse contains the response from method ComputeClient.Start. -type ComputeClientStartPollerResponse struct { - // Poller contains an initialized poller. - Poller *ComputeClientStartPoller - - // 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 ComputeClientStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ComputeClientStartResponse, error) { - respType := ComputeClientStartResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ComputeClientStartPollerResponse from the provided client and resume token. -func (l *ComputeClientStartPollerResponse) Resume(ctx context.Context, client *ComputeClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ComputeClient.Start", token, client.pl) - if err != nil { - return err - } - poller := &ComputeClientStartPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // ComputeClientStartResponse contains the response from method ComputeClient.Start. type ComputeClientStartResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ComputeClientStopPollerResponse contains the response from method ComputeClient.Stop. -type ComputeClientStopPollerResponse struct { - // Poller contains an initialized poller. - Poller *ComputeClientStopPoller - - // 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 ComputeClientStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ComputeClientStopResponse, error) { - respType := ComputeClientStopResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ComputeClientStopPollerResponse from the provided client and resume token. -func (l *ComputeClientStopPollerResponse) Resume(ctx context.Context, client *ComputeClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ComputeClient.Stop", token, client.pl) - if err != nil { - return err - } - poller := &ComputeClientStopPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // ComputeClientStopResponse contains the response from method ComputeClient.Stop. type ComputeClientStopResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ComputeClientUpdatePollerResponse contains the response from method ComputeClient.Update. -type ComputeClientUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *ComputeClientUpdatePoller - - // 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 ComputeClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ComputeClientUpdateResponse, error) { - respType := ComputeClientUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ComputeResource) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ComputeClientUpdatePollerResponse from the provided client and resume token. -func (l *ComputeClientUpdatePollerResponse) Resume(ctx context.Context, client *ComputeClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ComputeClient.Update", token, client.pl) - if err != nil { - return err - } - poller := &ComputeClientUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // ComputeClientUpdateResponse contains the response from method ComputeClient.Update. type ComputeClientUpdateResponse struct { - ComputeClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ComputeClientUpdateResult contains the result from method ComputeClient.Update. -type ComputeClientUpdateResult struct { ComputeResource } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationListResult } // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.CreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { - PrivateEndpointConnectionsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientCreateOrUpdateResult contains the result from method PrivateEndpointConnectionsClient.CreateOrUpdate. -type PrivateEndpointConnectionsClientCreateOrUpdateResult struct { PrivateEndpointConnection } // PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. type PrivateEndpointConnectionsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { - PrivateEndpointConnectionsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientGetResult contains the result from method PrivateEndpointConnectionsClient.Get. -type PrivateEndpointConnectionsClientGetResult struct { PrivateEndpointConnection } // PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.List. type PrivateEndpointConnectionsClientListResponse struct { - PrivateEndpointConnectionsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientListResult contains the result from method PrivateEndpointConnectionsClient.List. -type PrivateEndpointConnectionsClientListResult struct { PrivateEndpointConnectionListResult } // PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.List. type PrivateLinkResourcesClientListResponse struct { - PrivateLinkResourcesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateLinkResourcesClientListResult contains the result from method PrivateLinkResourcesClient.List. -type PrivateLinkResourcesClientListResult struct { PrivateLinkResourceListResult } // QuotasClientListResponse contains the response from method QuotasClient.List. type QuotasClientListResponse struct { - QuotasClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// QuotasClientListResult contains the result from method QuotasClient.List. -type QuotasClientListResult struct { ListWorkspaceQuotas } // QuotasClientUpdateResponse contains the response from method QuotasClient.Update. type QuotasClientUpdateResponse struct { - QuotasClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// QuotasClientUpdateResult contains the result from method QuotasClient.Update. -type QuotasClientUpdateResult struct { UpdateWorkspaceQuotasResult } // UsagesClientListResponse contains the response from method UsagesClient.List. type UsagesClientListResponse struct { - UsagesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// UsagesClientListResult contains the result from method UsagesClient.List. -type UsagesClientListResult struct { ListUsagesResult } // VirtualMachineSizesClientListResponse contains the response from method VirtualMachineSizesClient.List. type VirtualMachineSizesClientListResponse struct { - VirtualMachineSizesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachineSizesClientListResult contains the result from method VirtualMachineSizesClient.List. -type VirtualMachineSizesClientListResult struct { VirtualMachineSizeListResult } // WorkspaceConnectionsClientCreateResponse contains the response from method WorkspaceConnectionsClient.Create. type WorkspaceConnectionsClientCreateResponse struct { - WorkspaceConnectionsClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspaceConnectionsClientCreateResult contains the result from method WorkspaceConnectionsClient.Create. -type WorkspaceConnectionsClientCreateResult struct { WorkspaceConnection } // WorkspaceConnectionsClientDeleteResponse contains the response from method WorkspaceConnectionsClient.Delete. type WorkspaceConnectionsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // WorkspaceConnectionsClientGetResponse contains the response from method WorkspaceConnectionsClient.Get. type WorkspaceConnectionsClientGetResponse struct { - WorkspaceConnectionsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspaceConnectionsClientGetResult contains the result from method WorkspaceConnectionsClient.Get. -type WorkspaceConnectionsClientGetResult struct { WorkspaceConnection } // WorkspaceConnectionsClientListResponse contains the response from method WorkspaceConnectionsClient.List. type WorkspaceConnectionsClientListResponse struct { - WorkspaceConnectionsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspaceConnectionsClientListResult contains the result from method WorkspaceConnectionsClient.List. -type WorkspaceConnectionsClientListResult struct { PaginatedWorkspaceConnectionsList } // WorkspaceFeaturesClientListResponse contains the response from method WorkspaceFeaturesClient.List. type WorkspaceFeaturesClientListResponse struct { - WorkspaceFeaturesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspaceFeaturesClientListResult contains the result from method WorkspaceFeaturesClient.List. -type WorkspaceFeaturesClientListResult struct { ListAmlUserFeatureResult } // WorkspaceSKUsClientListResponse contains the response from method WorkspaceSKUsClient.List. type WorkspaceSKUsClientListResponse struct { - WorkspaceSKUsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspaceSKUsClientListResult contains the result from method WorkspaceSKUsClient.List. -type WorkspaceSKUsClientListResult struct { SKUListResult } -// WorkspacesClientCreateOrUpdatePollerResponse contains the response from method WorkspacesClient.CreateOrUpdate. -type WorkspacesClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *WorkspacesClientCreateOrUpdatePoller - - // 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 WorkspacesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesClientCreateOrUpdateResponse, error) { - respType := WorkspacesClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Workspace) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a WorkspacesClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *WorkspacesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *WorkspacesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("WorkspacesClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &WorkspacesClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // WorkspacesClientCreateOrUpdateResponse contains the response from method WorkspacesClient.CreateOrUpdate. type WorkspacesClientCreateOrUpdateResponse struct { - WorkspacesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspacesClientCreateOrUpdateResult contains the result from method WorkspacesClient.CreateOrUpdate. -type WorkspacesClientCreateOrUpdateResult struct { Workspace } -// WorkspacesClientDeletePollerResponse contains the response from method WorkspacesClient.Delete. -type WorkspacesClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *WorkspacesClientDeletePoller - - // 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 WorkspacesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesClientDeleteResponse, error) { - respType := WorkspacesClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a WorkspacesClientDeletePollerResponse from the provided client and resume token. -func (l *WorkspacesClientDeletePollerResponse) Resume(ctx context.Context, client *WorkspacesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("WorkspacesClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &WorkspacesClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // WorkspacesClientDeleteResponse contains the response from method WorkspacesClient.Delete. type WorkspacesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspacesClientDiagnosePollerResponse contains the response from method WorkspacesClient.Diagnose. -type WorkspacesClientDiagnosePollerResponse struct { - // Poller contains an initialized poller. - Poller *WorkspacesClientDiagnosePoller - - // 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 WorkspacesClientDiagnosePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesClientDiagnoseResponse, error) { - respType := WorkspacesClientDiagnoseResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DiagnoseResponseResult) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a WorkspacesClientDiagnosePollerResponse from the provided client and resume token. -func (l *WorkspacesClientDiagnosePollerResponse) Resume(ctx context.Context, client *WorkspacesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("WorkspacesClient.Diagnose", token, client.pl) - if err != nil { - return err - } - poller := &WorkspacesClientDiagnosePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // WorkspacesClientDiagnoseResponse contains the response from method WorkspacesClient.Diagnose. type WorkspacesClientDiagnoseResponse struct { - WorkspacesClientDiagnoseResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspacesClientDiagnoseResult contains the result from method WorkspacesClient.Diagnose. -type WorkspacesClientDiagnoseResult struct { DiagnoseResponseResult } // WorkspacesClientGetResponse contains the response from method WorkspacesClient.Get. type WorkspacesClientGetResponse struct { - WorkspacesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspacesClientGetResult contains the result from method WorkspacesClient.Get. -type WorkspacesClientGetResult struct { Workspace } // WorkspacesClientListByResourceGroupResponse contains the response from method WorkspacesClient.ListByResourceGroup. type WorkspacesClientListByResourceGroupResponse struct { - WorkspacesClientListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspacesClientListByResourceGroupResult contains the result from method WorkspacesClient.ListByResourceGroup. -type WorkspacesClientListByResourceGroupResult struct { WorkspaceListResult } // WorkspacesClientListBySubscriptionResponse contains the response from method WorkspacesClient.ListBySubscription. type WorkspacesClientListBySubscriptionResponse struct { - WorkspacesClientListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspacesClientListBySubscriptionResult contains the result from method WorkspacesClient.ListBySubscription. -type WorkspacesClientListBySubscriptionResult struct { WorkspaceListResult } // WorkspacesClientListKeysResponse contains the response from method WorkspacesClient.ListKeys. type WorkspacesClientListKeysResponse struct { - WorkspacesClientListKeysResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspacesClientListKeysResult contains the result from method WorkspacesClient.ListKeys. -type WorkspacesClientListKeysResult struct { ListWorkspaceKeysResult } // WorkspacesClientListNotebookAccessTokenResponse contains the response from method WorkspacesClient.ListNotebookAccessToken. type WorkspacesClientListNotebookAccessTokenResponse struct { - WorkspacesClientListNotebookAccessTokenResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspacesClientListNotebookAccessTokenResult contains the result from method WorkspacesClient.ListNotebookAccessToken. -type WorkspacesClientListNotebookAccessTokenResult struct { NotebookAccessTokenResult } // WorkspacesClientListNotebookKeysResponse contains the response from method WorkspacesClient.ListNotebookKeys. type WorkspacesClientListNotebookKeysResponse struct { - WorkspacesClientListNotebookKeysResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspacesClientListNotebookKeysResult contains the result from method WorkspacesClient.ListNotebookKeys. -type WorkspacesClientListNotebookKeysResult struct { ListNotebookKeysResult } // WorkspacesClientListOutboundNetworkDependenciesEndpointsResponse contains the response from method WorkspacesClient.ListOutboundNetworkDependenciesEndpoints. type WorkspacesClientListOutboundNetworkDependenciesEndpointsResponse struct { - WorkspacesClientListOutboundNetworkDependenciesEndpointsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspacesClientListOutboundNetworkDependenciesEndpointsResult contains the result from method WorkspacesClient.ListOutboundNetworkDependenciesEndpoints. -type WorkspacesClientListOutboundNetworkDependenciesEndpointsResult struct { ExternalFQDNResponse } // WorkspacesClientListStorageAccountKeysResponse contains the response from method WorkspacesClient.ListStorageAccountKeys. type WorkspacesClientListStorageAccountKeysResponse struct { - WorkspacesClientListStorageAccountKeysResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspacesClientListStorageAccountKeysResult contains the result from method WorkspacesClient.ListStorageAccountKeys. -type WorkspacesClientListStorageAccountKeysResult struct { ListStorageAccountKeysResult } -// WorkspacesClientPrepareNotebookPollerResponse contains the response from method WorkspacesClient.PrepareNotebook. -type WorkspacesClientPrepareNotebookPollerResponse struct { - // Poller contains an initialized poller. - Poller *WorkspacesClientPrepareNotebookPoller - - // 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 WorkspacesClientPrepareNotebookPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesClientPrepareNotebookResponse, error) { - respType := WorkspacesClientPrepareNotebookResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NotebookResourceInfo) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a WorkspacesClientPrepareNotebookPollerResponse from the provided client and resume token. -func (l *WorkspacesClientPrepareNotebookPollerResponse) Resume(ctx context.Context, client *WorkspacesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("WorkspacesClient.PrepareNotebook", token, client.pl) - if err != nil { - return err - } - poller := &WorkspacesClientPrepareNotebookPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // WorkspacesClientPrepareNotebookResponse contains the response from method WorkspacesClient.PrepareNotebook. type WorkspacesClientPrepareNotebookResponse struct { - WorkspacesClientPrepareNotebookResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspacesClientPrepareNotebookResult contains the result from method WorkspacesClient.PrepareNotebook. -type WorkspacesClientPrepareNotebookResult struct { NotebookResourceInfo } -// WorkspacesClientResyncKeysPollerResponse contains the response from method WorkspacesClient.ResyncKeys. -type WorkspacesClientResyncKeysPollerResponse struct { - // Poller contains an initialized poller. - Poller *WorkspacesClientResyncKeysPoller - - // 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 WorkspacesClientResyncKeysPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesClientResyncKeysResponse, error) { - respType := WorkspacesClientResyncKeysResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a WorkspacesClientResyncKeysPollerResponse from the provided client and resume token. -func (l *WorkspacesClientResyncKeysPollerResponse) Resume(ctx context.Context, client *WorkspacesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("WorkspacesClient.ResyncKeys", token, client.pl) - if err != nil { - return err - } - poller := &WorkspacesClientResyncKeysPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // WorkspacesClientResyncKeysResponse contains the response from method WorkspacesClient.ResyncKeys. type WorkspacesClientResyncKeysResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // WorkspacesClientUpdateResponse contains the response from method WorkspacesClient.Update. type WorkspacesClientUpdateResponse struct { - WorkspacesClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WorkspacesClientUpdateResult contains the result from method WorkspacesClient.Update. -type WorkspacesClientUpdateResult struct { Workspace } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_time_rfc3339.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_time_rfc3339.go index a938b251b281..0dd2b05e2c51 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_usages_client.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_usages_client.go index 76287654f699..9a7c43d1512a 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_usages_client.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_usages_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,36 +34,56 @@ type UsagesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UsagesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &UsagesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Gets the current usage information as well as limits for AML resources for given subscription and location. // If the operation fails it returns an *azcore.ResponseError type. // location - The location for which resource usage is queried. // options - UsagesClientListOptions contains the optional parameters for the UsagesClient.List method. -func (client *UsagesClient) List(location string, options *UsagesClientListOptions) *UsagesClientListPager { - return &UsagesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, location, options) +func (client *UsagesClient) List(location string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[UsagesClientListResponse]{ + More: func(page UsagesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp UsagesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ListUsagesResult.NextLink) + Fetcher: func(ctx context.Context, page *UsagesClientListResponse) (UsagesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return UsagesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UsagesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UsagesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -89,7 +110,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri // listHandleResponse handles the List response. func (client *UsagesClient) listHandleResponse(resp *http.Response) (UsagesClientListResponse, error) { - result := UsagesClientListResponse{RawResponse: resp} + result := UsagesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListUsagesResult); err != nil { return UsagesClientListResponse{}, err } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_virtualmachinesizes_client.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_virtualmachinesizes_client.go index fe7f783caf53..6b41f7b6b8af 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_virtualmachinesizes_client.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_virtualmachinesizes_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type VirtualMachineSizesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewVirtualMachineSizesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineSizesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewVirtualMachineSizesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineSizesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &VirtualMachineSizesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Returns supported VM Sizes in a location @@ -93,7 +98,7 @@ func (client *VirtualMachineSizesClient) listCreateRequest(ctx context.Context, // listHandleResponse handles the List response. func (client *VirtualMachineSizesClient) listHandleResponse(resp *http.Response) (VirtualMachineSizesClientListResponse, error) { - result := VirtualMachineSizesClientListResponse{RawResponse: resp} + result := VirtualMachineSizesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineSizeListResult); err != nil { return VirtualMachineSizesClientListResponse{}, err } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspaceconnections_client.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspaceconnections_client.go index 21cc8ac0b101..1295034ae560 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspaceconnections_client.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspaceconnections_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type WorkspaceConnectionsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewWorkspaceConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkspaceConnectionsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewWorkspaceConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &WorkspaceConnectionsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Create - Add a new workspace connection. @@ -104,7 +109,7 @@ func (client *WorkspaceConnectionsClient) createCreateRequest(ctx context.Contex // createHandleResponse handles the Create response. func (client *WorkspaceConnectionsClient) createHandleResponse(resp *http.Response) (WorkspaceConnectionsClientCreateResponse, error) { - result := WorkspaceConnectionsClientCreateResponse{RawResponse: resp} + result := WorkspaceConnectionsClientCreateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceConnection); err != nil { return WorkspaceConnectionsClientCreateResponse{}, err } @@ -130,7 +135,7 @@ func (client *WorkspaceConnectionsClient) Delete(ctx context.Context, resourceGr if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return WorkspaceConnectionsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return WorkspaceConnectionsClientDeleteResponse{RawResponse: resp}, nil + return WorkspaceConnectionsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -217,7 +222,7 @@ func (client *WorkspaceConnectionsClient) getCreateRequest(ctx context.Context, // getHandleResponse handles the Get response. func (client *WorkspaceConnectionsClient) getHandleResponse(resp *http.Response) (WorkspaceConnectionsClientGetResponse, error) { - result := WorkspaceConnectionsClientGetResponse{RawResponse: resp} + result := WorkspaceConnectionsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceConnection); err != nil { return WorkspaceConnectionsClientGetResponse{}, err } @@ -230,19 +235,26 @@ func (client *WorkspaceConnectionsClient) getHandleResponse(resp *http.Response) // workspaceName - Name of Azure Machine Learning workspace. // options - WorkspaceConnectionsClientListOptions contains the optional parameters for the WorkspaceConnectionsClient.List // method. -func (client *WorkspaceConnectionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspaceConnectionsClientListOptions) (WorkspaceConnectionsClientListResponse, error) { - req, err := client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) - if err != nil { - return WorkspaceConnectionsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return WorkspaceConnectionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkspaceConnectionsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *WorkspaceConnectionsClient) List(resourceGroupName string, workspaceName string, options *WorkspaceConnectionsClientListOptions) *runtime.Pager[WorkspaceConnectionsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[WorkspaceConnectionsClientListResponse]{ + More: func(page WorkspaceConnectionsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *WorkspaceConnectionsClientListResponse) (WorkspaceConnectionsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) + if err != nil { + return WorkspaceConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkspaceConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -279,7 +291,7 @@ func (client *WorkspaceConnectionsClient) listCreateRequest(ctx context.Context, // listHandleResponse handles the List response. func (client *WorkspaceConnectionsClient) listHandleResponse(resp *http.Response) (WorkspaceConnectionsClientListResponse, error) { - result := WorkspaceConnectionsClientListResponse{RawResponse: resp} + result := WorkspaceConnectionsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PaginatedWorkspaceConnectionsList); err != nil { return WorkspaceConnectionsClientListResponse{}, err } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspacefeatures_client.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspacefeatures_client.go index 0bfaf7928fdf..7c0ba0ae78ca 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspacefeatures_client.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspacefeatures_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type WorkspaceFeaturesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewWorkspaceFeaturesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkspaceFeaturesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewWorkspaceFeaturesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceFeaturesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &WorkspaceFeaturesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Lists all enabled features for a workspace @@ -54,16 +59,32 @@ func NewWorkspaceFeaturesClient(subscriptionID string, credential azcore.TokenCr // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - Name of Azure Machine Learning workspace. // options - WorkspaceFeaturesClientListOptions contains the optional parameters for the WorkspaceFeaturesClient.List method. -func (client *WorkspaceFeaturesClient) List(resourceGroupName string, workspaceName string, options *WorkspaceFeaturesClientListOptions) *WorkspaceFeaturesClientListPager { - return &WorkspaceFeaturesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) +func (client *WorkspaceFeaturesClient) List(resourceGroupName string, workspaceName string, options *WorkspaceFeaturesClientListOptions) *runtime.Pager[WorkspaceFeaturesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[WorkspaceFeaturesClientListResponse]{ + More: func(page WorkspaceFeaturesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp WorkspaceFeaturesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ListAmlUserFeatureResult.NextLink) + Fetcher: func(ctx context.Context, page *WorkspaceFeaturesClientListResponse) (WorkspaceFeaturesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceFeaturesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkspaceFeaturesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceFeaturesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -94,7 +115,7 @@ func (client *WorkspaceFeaturesClient) listCreateRequest(ctx context.Context, re // listHandleResponse handles the List response. func (client *WorkspaceFeaturesClient) listHandleResponse(resp *http.Response) (WorkspaceFeaturesClientListResponse, error) { - result := WorkspaceFeaturesClientListResponse{RawResponse: resp} + result := WorkspaceFeaturesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListAmlUserFeatureResult); err != nil { return WorkspaceFeaturesClientListResponse{}, err } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspaces_client.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspaces_client.go index 5903e530687f..a0dcf5e13fa4 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspaces_client.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspaces_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type WorkspacesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewWorkspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkspacesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewWorkspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspacesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &WorkspacesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Creates or updates a workspace with the specified parameters. @@ -56,22 +61,16 @@ func NewWorkspacesClient(subscriptionID string, credential azcore.TokenCredentia // parameters - The parameters for creating or updating a machine learning workspace. // options - WorkspacesClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkspacesClient.BeginCreateOrUpdate // method. -func (client *WorkspacesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters Workspace, options *WorkspacesClientBeginCreateOrUpdateOptions) (WorkspacesClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, workspaceName, parameters, options) - if err != nil { - return WorkspacesClientCreateOrUpdatePollerResponse{}, err - } - result := WorkspacesClientCreateOrUpdatePollerResponse{ - RawResponse: resp, +func (client *WorkspacesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters Workspace, options *WorkspacesClientBeginCreateOrUpdateOptions) (*armruntime.Poller[WorkspacesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, workspaceName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[WorkspacesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[WorkspacesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("WorkspacesClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return WorkspacesClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &WorkspacesClientCreateOrUpdatePoller{ - pt: pt, - } - return result, nil } // CreateOrUpdate - Creates or updates a workspace with the specified parameters. @@ -122,22 +121,16 @@ func (client *WorkspacesClient) createOrUpdateCreateRequest(ctx context.Context, // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - Name of Azure Machine Learning workspace. // options - WorkspacesClientBeginDeleteOptions contains the optional parameters for the WorkspacesClient.BeginDelete method. -func (client *WorkspacesClient) BeginDelete(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesClientBeginDeleteOptions) (WorkspacesClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, workspaceName, options) - if err != nil { - return WorkspacesClientDeletePollerResponse{}, err - } - result := WorkspacesClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("WorkspacesClient.Delete", "", resp, client.pl) - if err != nil { - return WorkspacesClientDeletePollerResponse{}, err - } - result.Poller = &WorkspacesClientDeletePoller{ - pt: pt, +func (client *WorkspacesClient) BeginDelete(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesClientBeginDeleteOptions) (*armruntime.Poller[WorkspacesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, workspaceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[WorkspacesClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[WorkspacesClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - Deletes a machine learning workspace. @@ -189,22 +182,18 @@ func (client *WorkspacesClient) deleteCreateRequest(ctx context.Context, resourc // workspaceName - Name of Azure Machine Learning workspace. // options - WorkspacesClientBeginDiagnoseOptions contains the optional parameters for the WorkspacesClient.BeginDiagnose // method. -func (client *WorkspacesClient) BeginDiagnose(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesClientBeginDiagnoseOptions) (WorkspacesClientDiagnosePollerResponse, error) { - resp, err := client.diagnose(ctx, resourceGroupName, workspaceName, options) - if err != nil { - return WorkspacesClientDiagnosePollerResponse{}, err +func (client *WorkspacesClient) BeginDiagnose(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesClientBeginDiagnoseOptions) (*armruntime.Poller[WorkspacesClientDiagnoseResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.diagnose(ctx, resourceGroupName, workspaceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[WorkspacesClientDiagnoseResponse]{ + FinalStateVia: armruntime.FinalStateViaLocation, + }) + } else { + return armruntime.NewPollerFromResumeToken[WorkspacesClientDiagnoseResponse](options.ResumeToken, client.pl, nil) } - result := WorkspacesClientDiagnosePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("WorkspacesClient.Diagnose", "location", resp, client.pl) - if err != nil { - return WorkspacesClientDiagnosePollerResponse{}, err - } - result.Poller = &WorkspacesClientDiagnosePoller{ - pt: pt, - } - return result, nil } // Diagnose - Diagnose workspace setup issue. @@ -301,7 +290,7 @@ func (client *WorkspacesClient) getCreateRequest(ctx context.Context, resourceGr // getHandleResponse handles the Get response. func (client *WorkspacesClient) getHandleResponse(resp *http.Response) (WorkspacesClientGetResponse, error) { - result := WorkspacesClientGetResponse{RawResponse: resp} + result := WorkspacesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Workspace); err != nil { return WorkspacesClientGetResponse{}, err } @@ -313,16 +302,32 @@ func (client *WorkspacesClient) getHandleResponse(resp *http.Response) (Workspac // resourceGroupName - The name of the resource group. The name is case insensitive. // options - WorkspacesClientListByResourceGroupOptions contains the optional parameters for the WorkspacesClient.ListByResourceGroup // method. -func (client *WorkspacesClient) ListByResourceGroup(resourceGroupName string, options *WorkspacesClientListByResourceGroupOptions) *WorkspacesClientListByResourceGroupPager { - return &WorkspacesClientListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) +func (client *WorkspacesClient) ListByResourceGroup(resourceGroupName string, options *WorkspacesClientListByResourceGroupOptions) *runtime.Pager[WorkspacesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[WorkspacesClientListByResourceGroupResponse]{ + More: func(page WorkspacesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp WorkspacesClientListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.WorkspaceListResult.NextLink) + Fetcher: func(ctx context.Context, page *WorkspacesClientListByResourceGroupResponse) (WorkspacesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspacesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkspacesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspacesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) }, - } + }) } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. @@ -352,7 +357,7 @@ func (client *WorkspacesClient) listByResourceGroupCreateRequest(ctx context.Con // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *WorkspacesClient) listByResourceGroupHandleResponse(resp *http.Response) (WorkspacesClientListByResourceGroupResponse, error) { - result := WorkspacesClientListByResourceGroupResponse{RawResponse: resp} + result := WorkspacesClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceListResult); err != nil { return WorkspacesClientListByResourceGroupResponse{}, err } @@ -363,16 +368,32 @@ func (client *WorkspacesClient) listByResourceGroupHandleResponse(resp *http.Res // If the operation fails it returns an *azcore.ResponseError type. // options - WorkspacesClientListBySubscriptionOptions contains the optional parameters for the WorkspacesClient.ListBySubscription // method. -func (client *WorkspacesClient) ListBySubscription(options *WorkspacesClientListBySubscriptionOptions) *WorkspacesClientListBySubscriptionPager { - return &WorkspacesClientListBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) +func (client *WorkspacesClient) ListBySubscription(options *WorkspacesClientListBySubscriptionOptions) *runtime.Pager[WorkspacesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[WorkspacesClientListBySubscriptionResponse]{ + More: func(page WorkspacesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp WorkspacesClientListBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.WorkspaceListResult.NextLink) + Fetcher: func(ctx context.Context, page *WorkspacesClientListBySubscriptionResponse) (WorkspacesClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspacesClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkspacesClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspacesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) }, - } + }) } // listBySubscriptionCreateRequest creates the ListBySubscription request. @@ -398,7 +419,7 @@ func (client *WorkspacesClient) listBySubscriptionCreateRequest(ctx context.Cont // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *WorkspacesClient) listBySubscriptionHandleResponse(resp *http.Response) (WorkspacesClientListBySubscriptionResponse, error) { - result := WorkspacesClientListBySubscriptionResponse{RawResponse: resp} + result := WorkspacesClientListBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceListResult); err != nil { return WorkspacesClientListBySubscriptionResponse{}, err } @@ -454,7 +475,7 @@ func (client *WorkspacesClient) listKeysCreateRequest(ctx context.Context, resou // listKeysHandleResponse handles the ListKeys response. func (client *WorkspacesClient) listKeysHandleResponse(resp *http.Response) (WorkspacesClientListKeysResponse, error) { - result := WorkspacesClientListKeysResponse{RawResponse: resp} + result := WorkspacesClientListKeysResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListWorkspaceKeysResult); err != nil { return WorkspacesClientListKeysResponse{}, err } @@ -510,7 +531,7 @@ func (client *WorkspacesClient) listNotebookAccessTokenCreateRequest(ctx context // listNotebookAccessTokenHandleResponse handles the ListNotebookAccessToken response. func (client *WorkspacesClient) listNotebookAccessTokenHandleResponse(resp *http.Response) (WorkspacesClientListNotebookAccessTokenResponse, error) { - result := WorkspacesClientListNotebookAccessTokenResponse{RawResponse: resp} + result := WorkspacesClientListNotebookAccessTokenResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.NotebookAccessTokenResult); err != nil { return WorkspacesClientListNotebookAccessTokenResponse{}, err } @@ -566,7 +587,7 @@ func (client *WorkspacesClient) listNotebookKeysCreateRequest(ctx context.Contex // listNotebookKeysHandleResponse handles the ListNotebookKeys response. func (client *WorkspacesClient) listNotebookKeysHandleResponse(resp *http.Response) (WorkspacesClientListNotebookKeysResponse, error) { - result := WorkspacesClientListNotebookKeysResponse{RawResponse: resp} + result := WorkspacesClientListNotebookKeysResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListNotebookKeysResult); err != nil { return WorkspacesClientListNotebookKeysResponse{}, err } @@ -623,7 +644,7 @@ func (client *WorkspacesClient) listOutboundNetworkDependenciesEndpointsCreateRe // listOutboundNetworkDependenciesEndpointsHandleResponse handles the ListOutboundNetworkDependenciesEndpoints response. func (client *WorkspacesClient) listOutboundNetworkDependenciesEndpointsHandleResponse(resp *http.Response) (WorkspacesClientListOutboundNetworkDependenciesEndpointsResponse, error) { - result := WorkspacesClientListOutboundNetworkDependenciesEndpointsResponse{RawResponse: resp} + result := WorkspacesClientListOutboundNetworkDependenciesEndpointsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ExternalFQDNResponse); err != nil { return WorkspacesClientListOutboundNetworkDependenciesEndpointsResponse{}, err } @@ -679,7 +700,7 @@ func (client *WorkspacesClient) listStorageAccountKeysCreateRequest(ctx context. // listStorageAccountKeysHandleResponse handles the ListStorageAccountKeys response. func (client *WorkspacesClient) listStorageAccountKeysHandleResponse(resp *http.Response) (WorkspacesClientListStorageAccountKeysResponse, error) { - result := WorkspacesClientListStorageAccountKeysResponse{RawResponse: resp} + result := WorkspacesClientListStorageAccountKeysResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListStorageAccountKeysResult); err != nil { return WorkspacesClientListStorageAccountKeysResponse{}, err } @@ -692,22 +713,18 @@ func (client *WorkspacesClient) listStorageAccountKeysHandleResponse(resp *http. // workspaceName - Name of Azure Machine Learning workspace. // options - WorkspacesClientBeginPrepareNotebookOptions contains the optional parameters for the WorkspacesClient.BeginPrepareNotebook // method. -func (client *WorkspacesClient) BeginPrepareNotebook(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesClientBeginPrepareNotebookOptions) (WorkspacesClientPrepareNotebookPollerResponse, error) { - resp, err := client.prepareNotebook(ctx, resourceGroupName, workspaceName, options) - if err != nil { - return WorkspacesClientPrepareNotebookPollerResponse{}, err - } - result := WorkspacesClientPrepareNotebookPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("WorkspacesClient.PrepareNotebook", "location", resp, client.pl) - if err != nil { - return WorkspacesClientPrepareNotebookPollerResponse{}, err +func (client *WorkspacesClient) BeginPrepareNotebook(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesClientBeginPrepareNotebookOptions) (*armruntime.Poller[WorkspacesClientPrepareNotebookResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.prepareNotebook(ctx, resourceGroupName, workspaceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[WorkspacesClientPrepareNotebookResponse]{ + FinalStateVia: armruntime.FinalStateViaLocation, + }) + } else { + return armruntime.NewPollerFromResumeToken[WorkspacesClientPrepareNotebookResponse](options.ResumeToken, client.pl, nil) } - result.Poller = &WorkspacesClientPrepareNotebookPoller{ - pt: pt, - } - return result, nil } // PrepareNotebook - Prepare a notebook. @@ -760,22 +777,16 @@ func (client *WorkspacesClient) prepareNotebookCreateRequest(ctx context.Context // workspaceName - Name of Azure Machine Learning workspace. // options - WorkspacesClientBeginResyncKeysOptions contains the optional parameters for the WorkspacesClient.BeginResyncKeys // method. -func (client *WorkspacesClient) BeginResyncKeys(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesClientBeginResyncKeysOptions) (WorkspacesClientResyncKeysPollerResponse, error) { - resp, err := client.resyncKeys(ctx, resourceGroupName, workspaceName, options) - if err != nil { - return WorkspacesClientResyncKeysPollerResponse{}, err - } - result := WorkspacesClientResyncKeysPollerResponse{ - RawResponse: resp, +func (client *WorkspacesClient) BeginResyncKeys(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesClientBeginResyncKeysOptions) (*armruntime.Poller[WorkspacesClientResyncKeysResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resyncKeys(ctx, resourceGroupName, workspaceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[WorkspacesClientResyncKeysResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[WorkspacesClientResyncKeysResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("WorkspacesClient.ResyncKeys", "", resp, client.pl) - if err != nil { - return WorkspacesClientResyncKeysPollerResponse{}, err - } - result.Poller = &WorkspacesClientResyncKeysPoller{ - pt: pt, - } - return result, nil } // ResyncKeys - Resync all the keys associated with this workspace. This includes keys for the storage account, app insights @@ -871,7 +882,7 @@ func (client *WorkspacesClient) updateCreateRequest(ctx context.Context, resourc // updateHandleResponse handles the Update response. func (client *WorkspacesClient) updateHandleResponse(resp *http.Response) (WorkspacesClientUpdateResponse, error) { - result := WorkspacesClientUpdateResponse{RawResponse: resp} + result := WorkspacesClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Workspace); err != nil { return WorkspacesClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspaceskus_client.go b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspaceskus_client.go index 7388370719f2..50901e606911 100644 --- a/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspaceskus_client.go +++ b/sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_workspaceskus_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,35 +34,55 @@ type WorkspaceSKUsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewWorkspaceSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkspaceSKUsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewWorkspaceSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceSKUsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &WorkspaceSKUsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Lists all skus with associated features // If the operation fails it returns an *azcore.ResponseError type. // options - WorkspaceSKUsClientListOptions contains the optional parameters for the WorkspaceSKUsClient.List method. -func (client *WorkspaceSKUsClient) List(options *WorkspaceSKUsClientListOptions) *WorkspaceSKUsClientListPager { - return &WorkspaceSKUsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *WorkspaceSKUsClient) List(options *WorkspaceSKUsClientListOptions) *runtime.Pager[WorkspaceSKUsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[WorkspaceSKUsClientListResponse]{ + More: func(page WorkspaceSKUsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp WorkspaceSKUsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.SKUListResult.NextLink) + Fetcher: func(ctx context.Context, page *WorkspaceSKUsClientListResponse) (WorkspaceSKUsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceSKUsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkspaceSKUsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceSKUsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -84,7 +105,7 @@ func (client *WorkspaceSKUsClient) listCreateRequest(ctx context.Context, option // listHandleResponse handles the List response. func (client *WorkspaceSKUsClient) listHandleResponse(resp *http.Response) (WorkspaceSKUsClientListResponse, error) { - result := WorkspaceSKUsClientListResponse{RawResponse: resp} + result := WorkspaceSKUsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SKUListResult); err != nil { return WorkspaceSKUsClientListResponse{}, err } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/CHANGELOG.md b/sdk/resourcemanager/maintenance/armmaintenance/CHANGELOG.md index a712b98b54c3..33bbbe590025 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/CHANGELOG.md +++ b/sdk/resourcemanager/maintenance/armmaintenance/CHANGELOG.md @@ -1,5 +1,156 @@ # Release History +## 0.3.0 (2022-04-12) +### Breaking Changes + +- Function `*ConfigurationAssignmentsWithinSubscriptionClient.List` parameter(s) have been changed from `(context.Context, *ConfigurationAssignmentsWithinSubscriptionClientListOptions)` to `(*ConfigurationAssignmentsWithinSubscriptionClientListOptions)` +- Function `*ConfigurationAssignmentsWithinSubscriptionClient.List` return value(s) have been changed from `(ConfigurationAssignmentsWithinSubscriptionClientListResponse, error)` to `(*runtime.Pager[ConfigurationAssignmentsWithinSubscriptionClientListResponse])` +- Function `NewApplyUpdatesClient` return value(s) have been changed from `(*ApplyUpdatesClient)` to `(*ApplyUpdatesClient, error)` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `*OperationsClient.List` parameter(s) have been changed from `(context.Context, *OperationsClientListOptions)` to `(*OperationsClientListOptions)` +- Function `*OperationsClient.List` return value(s) have been changed from `(OperationsClientListResponse, error)` to `(*runtime.Pager[OperationsClientListResponse])` +- Function `NewConfigurationsClient` return value(s) have been changed from `(*ConfigurationsClient)` to `(*ConfigurationsClient, error)` +- Function `*ConfigurationsForResourceGroupClient.List` parameter(s) have been changed from `(context.Context, string, *ConfigurationsForResourceGroupClientListOptions)` to `(string, *ConfigurationsForResourceGroupClientListOptions)` +- Function `*ConfigurationsForResourceGroupClient.List` return value(s) have been changed from `(ConfigurationsForResourceGroupClientListResponse, error)` to `(*runtime.Pager[ConfigurationsForResourceGroupClientListResponse])` +- Function `*ApplyUpdateForResourceGroupClient.List` parameter(s) have been changed from `(context.Context, string, *ApplyUpdateForResourceGroupClientListOptions)` to `(string, *ApplyUpdateForResourceGroupClientListOptions)` +- Function `*ApplyUpdateForResourceGroupClient.List` return value(s) have been changed from `(ApplyUpdateForResourceGroupClientListResponse, error)` to `(*runtime.Pager[ApplyUpdateForResourceGroupClientListResponse])` +- Function `*UpdatesClient.List` parameter(s) have been changed from `(context.Context, string, string, string, string, *UpdatesClientListOptions)` to `(string, string, string, string, *UpdatesClientListOptions)` +- Function `*UpdatesClient.List` return value(s) have been changed from `(UpdatesClientListResponse, error)` to `(*runtime.Pager[UpdatesClientListResponse])` +- Function `NewApplyUpdateForResourceGroupClient` return value(s) have been changed from `(*ApplyUpdateForResourceGroupClient)` to `(*ApplyUpdateForResourceGroupClient, error)` +- Function `*ApplyUpdatesClient.List` parameter(s) have been changed from `(context.Context, *ApplyUpdatesClientListOptions)` to `(*ApplyUpdatesClientListOptions)` +- Function `*ApplyUpdatesClient.List` return value(s) have been changed from `(ApplyUpdatesClientListResponse, error)` to `(*runtime.Pager[ApplyUpdatesClientListResponse])` +- Function `NewPublicMaintenanceConfigurationsClient` return value(s) have been changed from `(*PublicMaintenanceConfigurationsClient)` to `(*PublicMaintenanceConfigurationsClient, error)` +- Function `*ConfigurationAssignmentsClient.ListParent` parameter(s) have been changed from `(context.Context, string, string, string, string, string, string, *ConfigurationAssignmentsClientListParentOptions)` to `(string, string, string, string, string, string, *ConfigurationAssignmentsClientListParentOptions)` +- Function `*ConfigurationAssignmentsClient.ListParent` return value(s) have been changed from `(ConfigurationAssignmentsClientListParentResponse, error)` to `(*runtime.Pager[ConfigurationAssignmentsClientListParentResponse])` +- Function `*PublicMaintenanceConfigurationsClient.List` parameter(s) have been changed from `(context.Context, *PublicMaintenanceConfigurationsClientListOptions)` to `(*PublicMaintenanceConfigurationsClientListOptions)` +- Function `*PublicMaintenanceConfigurationsClient.List` return value(s) have been changed from `(PublicMaintenanceConfigurationsClientListResponse, error)` to `(*runtime.Pager[PublicMaintenanceConfigurationsClientListResponse])` +- Function `NewConfigurationAssignmentsWithinSubscriptionClient` return value(s) have been changed from `(*ConfigurationAssignmentsWithinSubscriptionClient)` to `(*ConfigurationAssignmentsWithinSubscriptionClient, error)` +- Function `*ConfigurationsClient.List` parameter(s) have been changed from `(context.Context, *ConfigurationsClientListOptions)` to `(*ConfigurationsClientListOptions)` +- Function `*ConfigurationsClient.List` return value(s) have been changed from `(ConfigurationsClientListResponse, error)` to `(*runtime.Pager[ConfigurationsClientListResponse])` +- Function `NewUpdatesClient` return value(s) have been changed from `(*UpdatesClient)` to `(*UpdatesClient, error)` +- Function `NewConfigurationsForResourceGroupClient` return value(s) have been changed from `(*ConfigurationsForResourceGroupClient)` to `(*ConfigurationsForResourceGroupClient, error)` +- Function `*ConfigurationAssignmentsClient.List` parameter(s) have been changed from `(context.Context, string, string, string, string, *ConfigurationAssignmentsClientListOptions)` to `(string, string, string, string, *ConfigurationAssignmentsClientListOptions)` +- Function `*ConfigurationAssignmentsClient.List` return value(s) have been changed from `(ConfigurationAssignmentsClientListResponse, error)` to `(*runtime.Pager[ConfigurationAssignmentsClientListResponse])` +- Function `NewConfigurationAssignmentsClient` return value(s) have been changed from `(*ConfigurationAssignmentsClient)` to `(*ConfigurationAssignmentsClient, error)` +- Function `*UpdatesClient.ListParent` parameter(s) have been changed from `(context.Context, string, string, string, string, string, string, *UpdatesClientListParentOptions)` to `(string, string, string, string, string, string, *UpdatesClientListParentOptions)` +- Function `*UpdatesClient.ListParent` return value(s) have been changed from `(UpdatesClientListParentResponse, error)` to `(*runtime.Pager[UpdatesClientListParentResponse])` +- Type of `Operation.Properties` has been changed from `map[string]interface{}` to `interface{}` +- Function `ImpactType.ToPtr` has been removed +- Function `Visibility.ToPtr` has been removed +- Function `TaskScope.ToPtr` has been removed +- Function `MaintenanceScope.ToPtr` has been removed +- Function `UpdateStatus.ToPtr` has been removed +- Function `RebootOptions.ToPtr` has been removed +- Function `CreatedByType.ToPtr` has been removed +- Struct `ApplyUpdateForResourceGroupClientListResult` has been removed +- Struct `ApplyUpdatesClientCreateOrUpdateParentResult` has been removed +- Struct `ApplyUpdatesClientCreateOrUpdateResult` has been removed +- Struct `ApplyUpdatesClientGetParentResult` has been removed +- Struct `ApplyUpdatesClientGetResult` has been removed +- Struct `ApplyUpdatesClientListResult` has been removed +- Struct `ConfigurationAssignmentsClientCreateOrUpdateParentResult` has been removed +- Struct `ConfigurationAssignmentsClientCreateOrUpdateResult` has been removed +- Struct `ConfigurationAssignmentsClientDeleteParentResult` has been removed +- Struct `ConfigurationAssignmentsClientDeleteResult` has been removed +- Struct `ConfigurationAssignmentsClientGetParentResult` has been removed +- Struct `ConfigurationAssignmentsClientGetResult` has been removed +- Struct `ConfigurationAssignmentsClientListParentResult` has been removed +- Struct `ConfigurationAssignmentsClientListResult` has been removed +- Struct `ConfigurationAssignmentsWithinSubscriptionClientListResult` has been removed +- Struct `ConfigurationsClientCreateOrUpdateResult` has been removed +- Struct `ConfigurationsClientDeleteResult` has been removed +- Struct `ConfigurationsClientGetResult` has been removed +- Struct `ConfigurationsClientListResult` has been removed +- Struct `ConfigurationsClientUpdateResult` has been removed +- Struct `ConfigurationsForResourceGroupClientListResult` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `PublicMaintenanceConfigurationsClientGetResult` has been removed +- Struct `PublicMaintenanceConfigurationsClientListResult` has been removed +- Struct `UpdatesClientListParentResult` has been removed +- Struct `UpdatesClientListResult` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `ConfigurationAssignmentsClientDeleteParentResult` of struct `ConfigurationAssignmentsClientDeleteParentResponse` has been removed +- Field `RawResponse` of struct `ConfigurationAssignmentsClientDeleteParentResponse` has been removed +- Field `ConfigurationAssignmentsClientGetParentResult` of struct `ConfigurationAssignmentsClientGetParentResponse` has been removed +- Field `RawResponse` of struct `ConfigurationAssignmentsClientGetParentResponse` has been removed +- Field `ConfigurationsClientCreateOrUpdateResult` of struct `ConfigurationsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ConfigurationsClientCreateOrUpdateResponse` has been removed +- Field `ConfigurationAssignmentsClientCreateOrUpdateResult` of struct `ConfigurationAssignmentsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ConfigurationAssignmentsClientCreateOrUpdateResponse` has been removed +- Field `UpdatesClientListParentResult` of struct `UpdatesClientListParentResponse` has been removed +- Field `RawResponse` of struct `UpdatesClientListParentResponse` has been removed +- Field `ConfigurationAssignmentsClientListResult` of struct `ConfigurationAssignmentsClientListResponse` has been removed +- Field `RawResponse` of struct `ConfigurationAssignmentsClientListResponse` has been removed +- Field `ConfigurationsClientGetResult` of struct `ConfigurationsClientGetResponse` has been removed +- Field `RawResponse` of struct `ConfigurationsClientGetResponse` has been removed +- Field `ConfigurationsClientUpdateResult` of struct `ConfigurationsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `ConfigurationsClientUpdateResponse` has been removed +- Field `UpdatesClientListResult` of struct `UpdatesClientListResponse` has been removed +- Field `RawResponse` of struct `UpdatesClientListResponse` has been removed +- Field `ApplyUpdatesClientCreateOrUpdateResult` of struct `ApplyUpdatesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ApplyUpdatesClientCreateOrUpdateResponse` has been removed +- Field `ApplyUpdatesClientListResult` of struct `ApplyUpdatesClientListResponse` has been removed +- Field `RawResponse` of struct `ApplyUpdatesClientListResponse` has been removed +- Field `ConfigurationAssignmentsWithinSubscriptionClientListResult` of struct `ConfigurationAssignmentsWithinSubscriptionClientListResponse` has been removed +- Field `RawResponse` of struct `ConfigurationAssignmentsWithinSubscriptionClientListResponse` has been removed +- Field `ConfigurationsClientDeleteResult` of struct `ConfigurationsClientDeleteResponse` has been removed +- Field `RawResponse` of struct `ConfigurationsClientDeleteResponse` has been removed +- Field `ConfigurationAssignmentsClientGetResult` of struct `ConfigurationAssignmentsClientGetResponse` has been removed +- Field `RawResponse` of struct `ConfigurationAssignmentsClientGetResponse` has been removed +- Field `PublicMaintenanceConfigurationsClientGetResult` of struct `PublicMaintenanceConfigurationsClientGetResponse` has been removed +- Field `RawResponse` of struct `PublicMaintenanceConfigurationsClientGetResponse` has been removed +- Field `ConfigurationAssignmentsClientCreateOrUpdateParentResult` of struct `ConfigurationAssignmentsClientCreateOrUpdateParentResponse` has been removed +- Field `RawResponse` of struct `ConfigurationAssignmentsClientCreateOrUpdateParentResponse` has been removed +- Field `ConfigurationsClientListResult` of struct `ConfigurationsClientListResponse` has been removed +- Field `RawResponse` of struct `ConfigurationsClientListResponse` has been removed +- Field `ApplyUpdatesClientCreateOrUpdateParentResult` of struct `ApplyUpdatesClientCreateOrUpdateParentResponse` has been removed +- Field `RawResponse` of struct `ApplyUpdatesClientCreateOrUpdateParentResponse` has been removed +- Field `ApplyUpdateForResourceGroupClientListResult` of struct `ApplyUpdateForResourceGroupClientListResponse` has been removed +- Field `RawResponse` of struct `ApplyUpdateForResourceGroupClientListResponse` has been removed +- Field `ApplyUpdatesClientGetParentResult` of struct `ApplyUpdatesClientGetParentResponse` has been removed +- Field `RawResponse` of struct `ApplyUpdatesClientGetParentResponse` has been removed +- Field `ConfigurationAssignmentsClientListParentResult` of struct `ConfigurationAssignmentsClientListParentResponse` has been removed +- Field `RawResponse` of struct `ConfigurationAssignmentsClientListParentResponse` has been removed +- Field `ConfigurationsForResourceGroupClientListResult` of struct `ConfigurationsForResourceGroupClientListResponse` has been removed +- Field `RawResponse` of struct `ConfigurationsForResourceGroupClientListResponse` has been removed +- Field `ConfigurationAssignmentsClientDeleteResult` of struct `ConfigurationAssignmentsClientDeleteResponse` has been removed +- Field `RawResponse` of struct `ConfigurationAssignmentsClientDeleteResponse` has been removed +- Field `ApplyUpdatesClientGetResult` of struct `ApplyUpdatesClientGetResponse` has been removed +- Field `RawResponse` of struct `ApplyUpdatesClientGetResponse` has been removed +- Field `PublicMaintenanceConfigurationsClientListResult` of struct `PublicMaintenanceConfigurationsClientListResponse` has been removed +- Field `RawResponse` of struct `PublicMaintenanceConfigurationsClientListResponse` has been removed + +### Features Added + +- New anonymous field `ConfigurationAssignment` in struct `ConfigurationAssignmentsClientCreateOrUpdateParentResponse` +- New anonymous field `ConfigurationAssignment` in struct `ConfigurationAssignmentsClientDeleteParentResponse` +- New anonymous field `ListApplyUpdate` in struct `ApplyUpdatesClientListResponse` +- New anonymous field `ListConfigurationAssignmentsResult` in struct `ConfigurationAssignmentsClientListResponse` +- New anonymous field `ListUpdatesResult` in struct `UpdatesClientListResponse` +- New anonymous field `ApplyUpdate` in struct `ApplyUpdatesClientCreateOrUpdateParentResponse` +- New anonymous field `Configuration` in struct `ConfigurationsClientDeleteResponse` +- New anonymous field `ListMaintenanceConfigurationsResult` in struct `PublicMaintenanceConfigurationsClientListResponse` +- New anonymous field `ConfigurationAssignment` in struct `ConfigurationAssignmentsClientGetResponse` +- New anonymous field `ApplyUpdate` in struct `ApplyUpdatesClientGetResponse` +- New anonymous field `ConfigurationAssignment` in struct `ConfigurationAssignmentsClientDeleteResponse` +- New anonymous field `ListConfigurationAssignmentsResult` in struct `ConfigurationAssignmentsClientListParentResponse` +- New anonymous field `Configuration` in struct `ConfigurationsClientCreateOrUpdateResponse` +- New anonymous field `ConfigurationAssignment` in struct `ConfigurationAssignmentsClientCreateOrUpdateResponse` +- New anonymous field `ListMaintenanceConfigurationsResult` in struct `ConfigurationsClientListResponse` +- New anonymous field `Configuration` in struct `PublicMaintenanceConfigurationsClientGetResponse` +- New anonymous field `ApplyUpdate` in struct `ApplyUpdatesClientCreateOrUpdateResponse` +- New anonymous field `OperationsListResult` in struct `OperationsClientListResponse` +- New anonymous field `Configuration` in struct `ConfigurationsClientUpdateResponse` +- New anonymous field `ListApplyUpdate` in struct `ApplyUpdateForResourceGroupClientListResponse` +- New anonymous field `ListUpdatesResult` in struct `UpdatesClientListParentResponse` +- New anonymous field `ApplyUpdate` in struct `ApplyUpdatesClientGetParentResponse` +- New anonymous field `Configuration` in struct `ConfigurationsClientGetResponse` +- New anonymous field `ConfigurationAssignment` in struct `ConfigurationAssignmentsClientGetParentResponse` +- New anonymous field `ListMaintenanceConfigurationsResult` in struct `ConfigurationsForResourceGroupClientListResponse` +- New anonymous field `ListConfigurationAssignmentsResult` in struct `ConfigurationAssignmentsWithinSubscriptionClientListResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/maintenance/armmaintenance/README.md b/sdk/resourcemanager/maintenance/armmaintenance/README.md index 3e8366c7f813..0c429d05a90b 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/README.md +++ b/sdk/resourcemanager/maintenance/armmaintenance/README.md @@ -11,7 +11,7 @@ The `armmaintenance` module provides operations for working with Azure Maintenan ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Maintenance 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 -client := armmaintenance.NewApplyUpdatesClient(, cred, nil) +client, err := armmaintenance.NewApplyUpdatesClient(, cred, nil) ``` 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 -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armmaintenance.NewApplyUpdatesClient(, cred, &options) +client, err := armmaintenance.NewApplyUpdatesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/maintenance/armmaintenance/autorest.md b/sdk/resourcemanager/maintenance/armmaintenance/autorest.md index 0f0b10e7f399..d2f0d4304855 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/autorest.md +++ b/sdk/resourcemanager/maintenance/armmaintenance/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/maintenance/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/maintenance/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/maintenance/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/maintenance/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/maintenance/armmaintenance/go.mod b/sdk/resourcemanager/maintenance/armmaintenance/go.mod index 99bd47af662e..45357b7ad2a2 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/go.mod +++ b/sdk/resourcemanager/maintenance/armmaintenance/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maintenance/armmaintenance -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/maintenance/armmaintenance/go.sum b/sdk/resourcemanager/maintenance/armmaintenance/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/go.sum +++ b/sdk/resourcemanager/maintenance/armmaintenance/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm 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/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/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-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_applyupdateforresourcegroup_client_test.go b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_applyupdateforresourcegroup_client_test.go index 158013971f19..21cca60ff961 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_applyupdateforresourcegroup_client_test.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_applyupdateforresourcegroup_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,19 +16,30 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maintenance/armmaintenance" ) -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ApplyUpdatesResourceGroup_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ApplyUpdatesResourceGroup_List.json func ExampleApplyUpdateForResourceGroupClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewApplyUpdateForResourceGroupClient("", cred, nil) - res, err := client.List(ctx, - "", - nil) + client, err := armmaintenance.NewApplyUpdateForResourceGroupClient("", cred, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List("", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.ApplyUpdateForResourceGroupClientListResult) } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_applyupdates_client_test.go b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_applyupdates_client_test.go index c83460894eb7..30f6ee45a812 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_applyupdates_client_test.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_applyupdates_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,14 +16,19 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maintenance/armmaintenance" ) -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ApplyUpdates_GetParent.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ApplyUpdates_GetParent.json func ExampleApplyUpdatesClient_GetParent() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewApplyUpdatesClient("", cred, nil) + client, err := armmaintenance.NewApplyUpdatesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.GetParent(ctx, "", "", @@ -34,19 +39,26 @@ func ExampleApplyUpdatesClient_GetParent() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ApplyUpdatesClientGetParentResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ApplyUpdates_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ApplyUpdates_Get.json func ExampleApplyUpdatesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewApplyUpdatesClient("", cred, nil) + client, err := armmaintenance.NewApplyUpdatesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", @@ -55,19 +67,26 @@ func ExampleApplyUpdatesClient_Get() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ApplyUpdatesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ApplyUpdates_CreateOrUpdateParent.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ApplyUpdates_CreateOrUpdateParent.json func ExampleApplyUpdatesClient_CreateOrUpdateParent() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewApplyUpdatesClient("", cred, nil) + client, err := armmaintenance.NewApplyUpdatesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdateParent(ctx, "", "", @@ -77,19 +96,26 @@ func ExampleApplyUpdatesClient_CreateOrUpdateParent() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ApplyUpdatesClientCreateOrUpdateParentResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ApplyUpdates_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ApplyUpdates_CreateOrUpdate.json func ExampleApplyUpdatesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewApplyUpdatesClient("", cred, nil) + client, err := armmaintenance.NewApplyUpdatesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", @@ -97,23 +123,36 @@ func ExampleApplyUpdatesClient_CreateOrUpdate() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ApplyUpdatesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ApplyUpdates_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ApplyUpdates_List.json func ExampleApplyUpdatesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewApplyUpdatesClient("", cred, nil) - res, err := client.List(ctx, - nil) + client, err := armmaintenance.NewApplyUpdatesClient("", cred, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.ApplyUpdatesClientListResult) } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_configurationassignments_client_test.go b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_configurationassignments_client_test.go index 1c181e705df5..3d1253f4808e 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_configurationassignments_client_test.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_configurationassignments_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,14 +17,19 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maintenance/armmaintenance" ) -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_GetParent.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_GetParent.json func ExampleConfigurationAssignmentsClient_GetParent() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + client, err := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.GetParent(ctx, "", "", @@ -35,19 +40,26 @@ func ExampleConfigurationAssignmentsClient_GetParent() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ConfigurationAssignmentsClientGetParentResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_CreateOrUpdateParent.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_CreateOrUpdateParent.json func ExampleConfigurationAssignmentsClient_CreateOrUpdateParent() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + client, err := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdateParent(ctx, "", "", @@ -58,24 +70,31 @@ func ExampleConfigurationAssignmentsClient_CreateOrUpdateParent() { "", armmaintenance.ConfigurationAssignment{ Properties: &armmaintenance.ConfigurationAssignmentProperties{ - MaintenanceConfigurationID: to.StringPtr(""), + MaintenanceConfigurationID: to.Ptr(""), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ConfigurationAssignmentsClientCreateOrUpdateParentResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_DeleteParent.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_DeleteParent.json func ExampleConfigurationAssignmentsClient_DeleteParent() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + client, err := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.DeleteParent(ctx, "", "", @@ -86,19 +105,26 @@ func ExampleConfigurationAssignmentsClient_DeleteParent() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ConfigurationAssignmentsClientDeleteParentResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_Get.json func ExampleConfigurationAssignmentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + client, err := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", @@ -107,19 +133,26 @@ func ExampleConfigurationAssignmentsClient_Get() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ConfigurationAssignmentsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_CreateOrUpdate.json func ExampleConfigurationAssignmentsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + client, err := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", @@ -128,24 +161,31 @@ func ExampleConfigurationAssignmentsClient_CreateOrUpdate() { "", armmaintenance.ConfigurationAssignment{ Properties: &armmaintenance.ConfigurationAssignmentProperties{ - MaintenanceConfigurationID: to.StringPtr(""), + MaintenanceConfigurationID: to.Ptr(""), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ConfigurationAssignmentsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_Delete.json func ExampleConfigurationAssignmentsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + client, err := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Delete(ctx, "", "", @@ -154,49 +194,73 @@ func ExampleConfigurationAssignmentsClient_Delete() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ConfigurationAssignmentsClientDeleteResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_ListParent.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_ListParent.json func ExampleConfigurationAssignmentsClient_ListParent() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) - res, err := client.ListParent(ctx, - "", + client, err := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.ListParent("", "", "", "", "", "", nil) - if err != nil { - log.Fatal(err) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.ConfigurationAssignmentsClientListParentResult) } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignments_List.json func ExampleConfigurationAssignmentsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) - res, err := client.List(ctx, - "", + client, err := armmaintenance.NewConfigurationAssignmentsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List("", "", "", "", nil) - if err != nil { - log.Fatal(err) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.ConfigurationAssignmentsClientListResult) } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_configurationassignmentswithinsubscription_client_test.go b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_configurationassignmentswithinsubscription_client_test.go index 12af720a3d41..f1f70a415c8e 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_configurationassignmentswithinsubscription_client_test.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_configurationassignmentswithinsubscription_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,18 +16,29 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maintenance/armmaintenance" ) -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignmentsResultWithinSubscription_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/ConfigurationAssignmentsResultWithinSubscription_List.json func ExampleConfigurationAssignmentsWithinSubscriptionClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationAssignmentsWithinSubscriptionClient("", cred, nil) - res, err := client.List(ctx, - nil) + client, err := armmaintenance.NewConfigurationAssignmentsWithinSubscriptionClient("", cred, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.ConfigurationAssignmentsWithinSubscriptionClientListResult) } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_maintenanceconfigurations_client_test.go b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_maintenanceconfigurations_client_test.go index 1a029561ac5e..f498b57625c7 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_maintenanceconfigurations_client_test.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_maintenanceconfigurations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,120 +17,159 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maintenance/armmaintenance" ) -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/MaintenanceConfigurations_GetForResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/MaintenanceConfigurations_GetForResource.json func ExampleConfigurationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationsClient("", cred, nil) + client, err := armmaintenance.NewConfigurationsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ConfigurationsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/MaintenanceConfigurations_CreateOrUpdateForResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/MaintenanceConfigurations_CreateOrUpdateForResource.json func ExampleConfigurationsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationsClient("", cred, nil) + client, err := armmaintenance.NewConfigurationsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", armmaintenance.Configuration{ - Location: to.StringPtr(""), + Location: to.Ptr(""), Properties: &armmaintenance.ConfigurationProperties{ - MaintenanceScope: armmaintenance.MaintenanceScope("OSImage").ToPtr(), + MaintenanceScope: to.Ptr(armmaintenance.MaintenanceScopeOSImage), MaintenanceWindow: &armmaintenance.Window{ - Duration: to.StringPtr(""), - ExpirationDateTime: to.StringPtr(""), - RecurEvery: to.StringPtr(""), - StartDateTime: to.StringPtr(""), - TimeZone: to.StringPtr(""), + Duration: to.Ptr(""), + ExpirationDateTime: to.Ptr(""), + RecurEvery: to.Ptr(""), + StartDateTime: to.Ptr(""), + TimeZone: to.Ptr(""), }, - Namespace: to.StringPtr(""), - Visibility: armmaintenance.Visibility("Custom").ToPtr(), + Namespace: to.Ptr(""), + Visibility: to.Ptr(armmaintenance.VisibilityCustom), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ConfigurationsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/MaintenanceConfigurations_DeleteForResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/MaintenanceConfigurations_DeleteForResource.json func ExampleConfigurationsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationsClient("", cred, nil) + client, err := armmaintenance.NewConfigurationsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Delete(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ConfigurationsClientDeleteResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/MaintenanceConfigurations_UpdateForResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/MaintenanceConfigurations_UpdateForResource.json func ExampleConfigurationsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationsClient("", cred, nil) + client, err := armmaintenance.NewConfigurationsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", armmaintenance.Configuration{ - Location: to.StringPtr(""), + Location: to.Ptr(""), Properties: &armmaintenance.ConfigurationProperties{ - MaintenanceScope: armmaintenance.MaintenanceScope("OSImage").ToPtr(), + MaintenanceScope: to.Ptr(armmaintenance.MaintenanceScopeOSImage), MaintenanceWindow: &armmaintenance.Window{ - Duration: to.StringPtr(""), - ExpirationDateTime: to.StringPtr(""), - RecurEvery: to.StringPtr(""), - StartDateTime: to.StringPtr(""), - TimeZone: to.StringPtr(""), + Duration: to.Ptr(""), + ExpirationDateTime: to.Ptr(""), + RecurEvery: to.Ptr(""), + StartDateTime: to.Ptr(""), + TimeZone: to.Ptr(""), }, - Namespace: to.StringPtr(""), - Visibility: armmaintenance.Visibility("Custom").ToPtr(), + Namespace: to.Ptr(""), + Visibility: to.Ptr(armmaintenance.VisibilityCustom), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ConfigurationsClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/MaintenanceConfigurations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/MaintenanceConfigurations_List.json func ExampleConfigurationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationsClient("", cred, nil) - res, err := client.List(ctx, - nil) + client, err := armmaintenance.NewConfigurationsClient("", cred, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.ConfigurationsClientListResult) } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_maintenanceconfigurationsforresourcegroup_client_test.go b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_maintenanceconfigurationsforresourcegroup_client_test.go index 1296cc6df4e2..67f9b6d01980 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_maintenanceconfigurationsforresourcegroup_client_test.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_maintenanceconfigurationsforresourcegroup_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,19 +16,30 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maintenance/armmaintenance" ) -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/MaintenanceConfigurationsResourceGroup_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/MaintenanceConfigurationsResourceGroup_List.json func ExampleConfigurationsForResourceGroupClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewConfigurationsForResourceGroupClient("", cred, nil) - res, err := client.List(ctx, - "", - nil) + client, err := armmaintenance.NewConfigurationsForResourceGroupClient("", cred, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List("", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.ConfigurationsForResourceGroupClientListResult) } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_operations_client_test.go index ca56be285a82..5b9adf4a71b7 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_operations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,18 +16,29 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maintenance/armmaintenance" ) -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/Operations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/Operations_List.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewOperationsClient(cred, nil) - res, err := client.List(ctx, - nil) + client, err := armmaintenance.NewOperationsClient(cred, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.OperationsClientListResult) } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_publicmaintenanceconfigurations_client_test.go b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_publicmaintenanceconfigurations_client_test.go index 2b5300536c1b..c9263be75803 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_publicmaintenanceconfigurations_client_test.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_publicmaintenanceconfigurations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,35 +16,53 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maintenance/armmaintenance" ) -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/PublicMaintenanceConfigurations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/PublicMaintenanceConfigurations_List.json func ExamplePublicMaintenanceConfigurationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewPublicMaintenanceConfigurationsClient("", cred, nil) - res, err := client.List(ctx, - nil) + client, err := armmaintenance.NewPublicMaintenanceConfigurationsClient("", cred, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.PublicMaintenanceConfigurationsClientListResult) } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/PublicMaintenanceConfigurations_GetForResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/PublicMaintenanceConfigurations_GetForResource.json func ExamplePublicMaintenanceConfigurationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewPublicMaintenanceConfigurationsClient("", cred, nil) + client, err := armmaintenance.NewPublicMaintenanceConfigurationsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PublicMaintenanceConfigurationsClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_updates_client_test.go b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_updates_client_test.go index 0757297490dd..7b5191250b22 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_updates_client_test.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/ze_generated_example_updates_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,44 +16,66 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maintenance/armmaintenance" ) -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/Updates_ListParent.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/Updates_ListParent.json func ExampleUpdatesClient_ListParent() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewUpdatesClient("", cred, nil) - res, err := client.ListParent(ctx, - "", + client, err := armmaintenance.NewUpdatesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.ListParent("", "", "", "", "", "", nil) - if err != nil { - log.Fatal(err) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.UpdatesClientListParentResult) } -// x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/Updates_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2021-09-01-preview/examples/Updates_List.json func ExampleUpdatesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaintenance.NewUpdatesClient("", cred, nil) - res, err := client.List(ctx, - "", + client, err := armmaintenance.NewUpdatesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List("", "", "", "", nil) - if err != nil { - log.Fatal(err) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.UpdatesClientListResult) } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_applyupdateforresourcegroup_client.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_applyupdateforresourcegroup_client.go index 38d1326f1d8c..ce2ebb664779 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_applyupdateforresourcegroup_client.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_applyupdateforresourcegroup_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type ApplyUpdateForResourceGroupClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewApplyUpdateForResourceGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ApplyUpdateForResourceGroupClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewApplyUpdateForResourceGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplyUpdateForResourceGroupClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ApplyUpdateForResourceGroupClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Get Configuration records within a subscription and resource group @@ -55,19 +60,26 @@ func NewApplyUpdateForResourceGroupClient(subscriptionID string, credential azco // resourceGroupName - Resource Group Name // options - ApplyUpdateForResourceGroupClientListOptions contains the optional parameters for the ApplyUpdateForResourceGroupClient.List // method. -func (client *ApplyUpdateForResourceGroupClient) List(ctx context.Context, resourceGroupName string, options *ApplyUpdateForResourceGroupClientListOptions) (ApplyUpdateForResourceGroupClientListResponse, error) { - req, err := client.listCreateRequest(ctx, resourceGroupName, options) - if err != nil { - return ApplyUpdateForResourceGroupClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ApplyUpdateForResourceGroupClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ApplyUpdateForResourceGroupClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *ApplyUpdateForResourceGroupClient) List(resourceGroupName string, options *ApplyUpdateForResourceGroupClientListOptions) *runtime.Pager[ApplyUpdateForResourceGroupClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ApplyUpdateForResourceGroupClientListResponse]{ + More: func(page ApplyUpdateForResourceGroupClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ApplyUpdateForResourceGroupClientListResponse) (ApplyUpdateForResourceGroupClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return ApplyUpdateForResourceGroupClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplyUpdateForResourceGroupClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplyUpdateForResourceGroupClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -94,7 +106,7 @@ func (client *ApplyUpdateForResourceGroupClient) listCreateRequest(ctx context.C // listHandleResponse handles the List response. func (client *ApplyUpdateForResourceGroupClient) listHandleResponse(resp *http.Response) (ApplyUpdateForResourceGroupClientListResponse, error) { - result := ApplyUpdateForResourceGroupClientListResponse{RawResponse: resp} + result := ApplyUpdateForResourceGroupClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListApplyUpdate); err != nil { return ApplyUpdateForResourceGroupClientListResponse{}, err } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_applyupdates_client.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_applyupdates_client.go index 2616b342d301..2f5bff318dcd 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_applyupdates_client.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_applyupdates_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type ApplyUpdatesClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewApplyUpdatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ApplyUpdatesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewApplyUpdatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplyUpdatesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ApplyUpdatesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Apply maintenance updates to resource @@ -109,7 +114,7 @@ func (client *ApplyUpdatesClient) createOrUpdateCreateRequest(ctx context.Contex // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *ApplyUpdatesClient) createOrUpdateHandleResponse(resp *http.Response) (ApplyUpdatesClientCreateOrUpdateResponse, error) { - result := ApplyUpdatesClientCreateOrUpdateResponse{RawResponse: resp} + result := ApplyUpdatesClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ApplyUpdate); err != nil { return ApplyUpdatesClientCreateOrUpdateResponse{}, err } @@ -185,7 +190,7 @@ func (client *ApplyUpdatesClient) createOrUpdateParentCreateRequest(ctx context. // createOrUpdateParentHandleResponse handles the CreateOrUpdateParent response. func (client *ApplyUpdatesClient) createOrUpdateParentHandleResponse(resp *http.Response) (ApplyUpdatesClientCreateOrUpdateParentResponse, error) { - result := ApplyUpdatesClientCreateOrUpdateParentResponse{RawResponse: resp} + result := ApplyUpdatesClientCreateOrUpdateParentResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ApplyUpdate); err != nil { return ApplyUpdatesClientCreateOrUpdateParentResponse{}, err } @@ -255,7 +260,7 @@ func (client *ApplyUpdatesClient) getCreateRequest(ctx context.Context, resource // getHandleResponse handles the Get response. func (client *ApplyUpdatesClient) getHandleResponse(resp *http.Response) (ApplyUpdatesClientGetResponse, error) { - result := ApplyUpdatesClientGetResponse{RawResponse: resp} + result := ApplyUpdatesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ApplyUpdate); err != nil { return ApplyUpdatesClientGetResponse{}, err } @@ -335,7 +340,7 @@ func (client *ApplyUpdatesClient) getParentCreateRequest(ctx context.Context, re // getParentHandleResponse handles the GetParent response. func (client *ApplyUpdatesClient) getParentHandleResponse(resp *http.Response) (ApplyUpdatesClientGetParentResponse, error) { - result := ApplyUpdatesClientGetParentResponse{RawResponse: resp} + result := ApplyUpdatesClientGetParentResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ApplyUpdate); err != nil { return ApplyUpdatesClientGetParentResponse{}, err } @@ -345,19 +350,26 @@ func (client *ApplyUpdatesClient) getParentHandleResponse(resp *http.Response) ( // List - Get Configuration records within a subscription // If the operation fails it returns an *azcore.ResponseError type. // options - ApplyUpdatesClientListOptions contains the optional parameters for the ApplyUpdatesClient.List method. -func (client *ApplyUpdatesClient) List(ctx context.Context, options *ApplyUpdatesClientListOptions) (ApplyUpdatesClientListResponse, error) { - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return ApplyUpdatesClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ApplyUpdatesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ApplyUpdatesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *ApplyUpdatesClient) List(options *ApplyUpdatesClientListOptions) *runtime.Pager[ApplyUpdatesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ApplyUpdatesClientListResponse]{ + More: func(page ApplyUpdatesClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ApplyUpdatesClientListResponse) (ApplyUpdatesClientListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return ApplyUpdatesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplyUpdatesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplyUpdatesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -380,7 +392,7 @@ func (client *ApplyUpdatesClient) listCreateRequest(ctx context.Context, options // listHandleResponse handles the List response. func (client *ApplyUpdatesClient) listHandleResponse(resp *http.Response) (ApplyUpdatesClientListResponse, error) { - result := ApplyUpdatesClientListResponse{RawResponse: resp} + result := ApplyUpdatesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListApplyUpdate); err != nil { return ApplyUpdatesClientListResponse{}, err } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurationassignments_client.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurationassignments_client.go index 300ebfbc55d5..3d2fd3b6c5c2 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurationassignments_client.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurationassignments_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type ConfigurationAssignmentsClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewConfigurationAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConfigurationAssignmentsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewConfigurationAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationAssignmentsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ConfigurationAssignmentsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Register configuration for resource. @@ -115,7 +120,7 @@ func (client *ConfigurationAssignmentsClient) createOrUpdateCreateRequest(ctx co // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *ConfigurationAssignmentsClient) createOrUpdateHandleResponse(resp *http.Response) (ConfigurationAssignmentsClientCreateOrUpdateResponse, error) { - result := ConfigurationAssignmentsClientCreateOrUpdateResponse{RawResponse: resp} + result := ConfigurationAssignmentsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationAssignment); err != nil { return ConfigurationAssignmentsClientCreateOrUpdateResponse{}, err } @@ -197,7 +202,7 @@ func (client *ConfigurationAssignmentsClient) createOrUpdateParentCreateRequest( // createOrUpdateParentHandleResponse handles the CreateOrUpdateParent response. func (client *ConfigurationAssignmentsClient) createOrUpdateParentHandleResponse(resp *http.Response) (ConfigurationAssignmentsClientCreateOrUpdateParentResponse, error) { - result := ConfigurationAssignmentsClientCreateOrUpdateParentResponse{RawResponse: resp} + result := ConfigurationAssignmentsClientCreateOrUpdateParentResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationAssignment); err != nil { return ConfigurationAssignmentsClientCreateOrUpdateParentResponse{}, err } @@ -268,7 +273,7 @@ func (client *ConfigurationAssignmentsClient) deleteCreateRequest(ctx context.Co // deleteHandleResponse handles the Delete response. func (client *ConfigurationAssignmentsClient) deleteHandleResponse(resp *http.Response) (ConfigurationAssignmentsClientDeleteResponse, error) { - result := ConfigurationAssignmentsClientDeleteResponse{RawResponse: resp} + result := ConfigurationAssignmentsClientDeleteResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationAssignment); err != nil { return ConfigurationAssignmentsClientDeleteResponse{}, err } @@ -349,7 +354,7 @@ func (client *ConfigurationAssignmentsClient) deleteParentCreateRequest(ctx cont // deleteParentHandleResponse handles the DeleteParent response. func (client *ConfigurationAssignmentsClient) deleteParentHandleResponse(resp *http.Response) (ConfigurationAssignmentsClientDeleteParentResponse, error) { - result := ConfigurationAssignmentsClientDeleteParentResponse{RawResponse: resp} + result := ConfigurationAssignmentsClientDeleteParentResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationAssignment); err != nil { return ConfigurationAssignmentsClientDeleteParentResponse{}, err } @@ -420,7 +425,7 @@ func (client *ConfigurationAssignmentsClient) getCreateRequest(ctx context.Conte // getHandleResponse handles the Get response. func (client *ConfigurationAssignmentsClient) getHandleResponse(resp *http.Response) (ConfigurationAssignmentsClientGetResponse, error) { - result := ConfigurationAssignmentsClientGetResponse{RawResponse: resp} + result := ConfigurationAssignmentsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationAssignment); err != nil { return ConfigurationAssignmentsClientGetResponse{}, err } @@ -501,7 +506,7 @@ func (client *ConfigurationAssignmentsClient) getParentCreateRequest(ctx context // getParentHandleResponse handles the GetParent response. func (client *ConfigurationAssignmentsClient) getParentHandleResponse(resp *http.Response) (ConfigurationAssignmentsClientGetParentResponse, error) { - result := ConfigurationAssignmentsClientGetParentResponse{RawResponse: resp} + result := ConfigurationAssignmentsClientGetParentResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationAssignment); err != nil { return ConfigurationAssignmentsClientGetParentResponse{}, err } @@ -516,19 +521,26 @@ func (client *ConfigurationAssignmentsClient) getParentHandleResponse(resp *http // resourceName - Resource identifier // options - ConfigurationAssignmentsClientListOptions contains the optional parameters for the ConfigurationAssignmentsClient.List // method. -func (client *ConfigurationAssignmentsClient) List(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string, options *ConfigurationAssignmentsClientListOptions) (ConfigurationAssignmentsClientListResponse, error) { - req, err := client.listCreateRequest(ctx, resourceGroupName, providerName, resourceType, resourceName, options) - if err != nil { - return ConfigurationAssignmentsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ConfigurationAssignmentsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConfigurationAssignmentsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *ConfigurationAssignmentsClient) List(resourceGroupName string, providerName string, resourceType string, resourceName string, options *ConfigurationAssignmentsClientListOptions) *runtime.Pager[ConfigurationAssignmentsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ConfigurationAssignmentsClientListResponse]{ + More: func(page ConfigurationAssignmentsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ConfigurationAssignmentsClientListResponse) (ConfigurationAssignmentsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, providerName, resourceType, resourceName, options) + if err != nil { + return ConfigurationAssignmentsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConfigurationAssignmentsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConfigurationAssignmentsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -567,7 +579,7 @@ func (client *ConfigurationAssignmentsClient) listCreateRequest(ctx context.Cont // listHandleResponse handles the List response. func (client *ConfigurationAssignmentsClient) listHandleResponse(resp *http.Response) (ConfigurationAssignmentsClientListResponse, error) { - result := ConfigurationAssignmentsClientListResponse{RawResponse: resp} + result := ConfigurationAssignmentsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListConfigurationAssignmentsResult); err != nil { return ConfigurationAssignmentsClientListResponse{}, err } @@ -584,19 +596,26 @@ func (client *ConfigurationAssignmentsClient) listHandleResponse(resp *http.Resp // resourceName - Resource identifier // options - ConfigurationAssignmentsClientListParentOptions contains the optional parameters for the ConfigurationAssignmentsClient.ListParent // method. -func (client *ConfigurationAssignmentsClient) ListParent(ctx context.Context, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string, options *ConfigurationAssignmentsClientListParentOptions) (ConfigurationAssignmentsClientListParentResponse, error) { - req, err := client.listParentCreateRequest(ctx, resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, options) - if err != nil { - return ConfigurationAssignmentsClientListParentResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ConfigurationAssignmentsClientListParentResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConfigurationAssignmentsClientListParentResponse{}, runtime.NewResponseError(resp) - } - return client.listParentHandleResponse(resp) +func (client *ConfigurationAssignmentsClient) ListParent(resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string, options *ConfigurationAssignmentsClientListParentOptions) *runtime.Pager[ConfigurationAssignmentsClientListParentResponse] { + return runtime.NewPager(runtime.PageProcessor[ConfigurationAssignmentsClientListParentResponse]{ + More: func(page ConfigurationAssignmentsClientListParentResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ConfigurationAssignmentsClientListParentResponse) (ConfigurationAssignmentsClientListParentResponse, error) { + req, err := client.listParentCreateRequest(ctx, resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, options) + if err != nil { + return ConfigurationAssignmentsClientListParentResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConfigurationAssignmentsClientListParentResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConfigurationAssignmentsClientListParentResponse{}, runtime.NewResponseError(resp) + } + return client.listParentHandleResponse(resp) + }, + }) } // listParentCreateRequest creates the ListParent request. @@ -643,7 +662,7 @@ func (client *ConfigurationAssignmentsClient) listParentCreateRequest(ctx contex // listParentHandleResponse handles the ListParent response. func (client *ConfigurationAssignmentsClient) listParentHandleResponse(resp *http.Response) (ConfigurationAssignmentsClientListParentResponse, error) { - result := ConfigurationAssignmentsClientListParentResponse{RawResponse: resp} + result := ConfigurationAssignmentsClientListParentResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListConfigurationAssignmentsResult); err != nil { return ConfigurationAssignmentsClientListParentResponse{}, err } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurationassignmentswithinsubscription_client.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurationassignmentswithinsubscription_client.go index a20495e843e9..86a05f52fee1 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurationassignmentswithinsubscription_client.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurationassignmentswithinsubscription_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,39 +35,50 @@ type ConfigurationAssignmentsWithinSubscriptionClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewConfigurationAssignmentsWithinSubscriptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConfigurationAssignmentsWithinSubscriptionClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewConfigurationAssignmentsWithinSubscriptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationAssignmentsWithinSubscriptionClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ConfigurationAssignmentsWithinSubscriptionClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Get configuration assignment within a subscription // If the operation fails it returns an *azcore.ResponseError type. // options - ConfigurationAssignmentsWithinSubscriptionClientListOptions contains the optional parameters for the ConfigurationAssignmentsWithinSubscriptionClient.List // method. -func (client *ConfigurationAssignmentsWithinSubscriptionClient) List(ctx context.Context, options *ConfigurationAssignmentsWithinSubscriptionClientListOptions) (ConfigurationAssignmentsWithinSubscriptionClientListResponse, error) { - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return ConfigurationAssignmentsWithinSubscriptionClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ConfigurationAssignmentsWithinSubscriptionClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConfigurationAssignmentsWithinSubscriptionClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *ConfigurationAssignmentsWithinSubscriptionClient) List(options *ConfigurationAssignmentsWithinSubscriptionClientListOptions) *runtime.Pager[ConfigurationAssignmentsWithinSubscriptionClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ConfigurationAssignmentsWithinSubscriptionClientListResponse]{ + More: func(page ConfigurationAssignmentsWithinSubscriptionClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ConfigurationAssignmentsWithinSubscriptionClientListResponse) (ConfigurationAssignmentsWithinSubscriptionClientListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return ConfigurationAssignmentsWithinSubscriptionClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConfigurationAssignmentsWithinSubscriptionClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConfigurationAssignmentsWithinSubscriptionClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -89,7 +101,7 @@ func (client *ConfigurationAssignmentsWithinSubscriptionClient) listCreateReques // listHandleResponse handles the List response. func (client *ConfigurationAssignmentsWithinSubscriptionClient) listHandleResponse(resp *http.Response) (ConfigurationAssignmentsWithinSubscriptionClientListResponse, error) { - result := ConfigurationAssignmentsWithinSubscriptionClientListResponse{RawResponse: resp} + result := ConfigurationAssignmentsWithinSubscriptionClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListConfigurationAssignmentsResult); err != nil { return ConfigurationAssignmentsWithinSubscriptionClientListResponse{}, err } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurations_client.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurations_client.go index 43fd9c73acc9..285986bddf87 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurations_client.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type ConfigurationsClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConfigurationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ConfigurationsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Create or Update configuration record @@ -100,7 +105,7 @@ func (client *ConfigurationsClient) createOrUpdateCreateRequest(ctx context.Cont // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *ConfigurationsClient) createOrUpdateHandleResponse(resp *http.Response) (ConfigurationsClientCreateOrUpdateResponse, error) { - result := ConfigurationsClientCreateOrUpdateResponse{RawResponse: resp} + result := ConfigurationsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Configuration); err != nil { return ConfigurationsClientCreateOrUpdateResponse{}, err } @@ -155,7 +160,7 @@ func (client *ConfigurationsClient) deleteCreateRequest(ctx context.Context, res // deleteHandleResponse handles the Delete response. func (client *ConfigurationsClient) deleteHandleResponse(resp *http.Response) (ConfigurationsClientDeleteResponse, error) { - result := ConfigurationsClientDeleteResponse{RawResponse: resp} + result := ConfigurationsClientDeleteResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Configuration); err != nil { return ConfigurationsClientDeleteResponse{}, err } @@ -210,7 +215,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour // getHandleResponse handles the Get response. func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (ConfigurationsClientGetResponse, error) { - result := ConfigurationsClientGetResponse{RawResponse: resp} + result := ConfigurationsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Configuration); err != nil { return ConfigurationsClientGetResponse{}, err } @@ -220,19 +225,26 @@ func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (Conf // List - Get Configuration records within a subscription // If the operation fails it returns an *azcore.ResponseError type. // options - ConfigurationsClientListOptions contains the optional parameters for the ConfigurationsClient.List method. -func (client *ConfigurationsClient) List(ctx context.Context, options *ConfigurationsClientListOptions) (ConfigurationsClientListResponse, error) { - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return ConfigurationsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ConfigurationsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConfigurationsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *ConfigurationsClient) List(options *ConfigurationsClientListOptions) *runtime.Pager[ConfigurationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ConfigurationsClientListResponse]{ + More: func(page ConfigurationsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ConfigurationsClientListResponse) (ConfigurationsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return ConfigurationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConfigurationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConfigurationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -255,7 +267,7 @@ func (client *ConfigurationsClient) listCreateRequest(ctx context.Context, optio // listHandleResponse handles the List response. func (client *ConfigurationsClient) listHandleResponse(resp *http.Response) (ConfigurationsClientListResponse, error) { - result := ConfigurationsClientListResponse{RawResponse: resp} + result := ConfigurationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListMaintenanceConfigurationsResult); err != nil { return ConfigurationsClientListResponse{}, err } @@ -311,7 +323,7 @@ func (client *ConfigurationsClient) updateCreateRequest(ctx context.Context, res // updateHandleResponse handles the Update response. func (client *ConfigurationsClient) updateHandleResponse(resp *http.Response) (ConfigurationsClientUpdateResponse, error) { - result := ConfigurationsClientUpdateResponse{RawResponse: resp} + result := ConfigurationsClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Configuration); err != nil { return ConfigurationsClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurationsforresourcegroup_client.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurationsforresourcegroup_client.go index e16619d92eec..dab2b053ca0c 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurationsforresourcegroup_client.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_configurationsforresourcegroup_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type ConfigurationsForResourceGroupClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewConfigurationsForResourceGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConfigurationsForResourceGroupClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewConfigurationsForResourceGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationsForResourceGroupClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ConfigurationsForResourceGroupClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Get Configuration records within a subscription and resource group @@ -55,19 +60,26 @@ func NewConfigurationsForResourceGroupClient(subscriptionID string, credential a // resourceGroupName - Resource Group Name // options - ConfigurationsForResourceGroupClientListOptions contains the optional parameters for the ConfigurationsForResourceGroupClient.List // method. -func (client *ConfigurationsForResourceGroupClient) List(ctx context.Context, resourceGroupName string, options *ConfigurationsForResourceGroupClientListOptions) (ConfigurationsForResourceGroupClientListResponse, error) { - req, err := client.listCreateRequest(ctx, resourceGroupName, options) - if err != nil { - return ConfigurationsForResourceGroupClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ConfigurationsForResourceGroupClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConfigurationsForResourceGroupClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *ConfigurationsForResourceGroupClient) List(resourceGroupName string, options *ConfigurationsForResourceGroupClientListOptions) *runtime.Pager[ConfigurationsForResourceGroupClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ConfigurationsForResourceGroupClientListResponse]{ + More: func(page ConfigurationsForResourceGroupClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ConfigurationsForResourceGroupClientListResponse) (ConfigurationsForResourceGroupClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return ConfigurationsForResourceGroupClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConfigurationsForResourceGroupClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConfigurationsForResourceGroupClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -94,7 +106,7 @@ func (client *ConfigurationsForResourceGroupClient) listCreateRequest(ctx contex // listHandleResponse handles the List response. func (client *ConfigurationsForResourceGroupClient) listHandleResponse(resp *http.Response) (ConfigurationsForResourceGroupClientListResponse, error) { - result := ConfigurationsForResourceGroupClientListResponse{RawResponse: resp} + result := ConfigurationsForResourceGroupClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListMaintenanceConfigurationsResult); err != nil { return ConfigurationsForResourceGroupClientListResponse{}, err } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_constants.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_constants.go index 3a5de0282862..6b5c831a21a2 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_constants.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armmaintenance const ( moduleName = "armmaintenance" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // CreatedByType - The type of identity that created the resource. @@ -33,11 +33,6 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// ToPtr returns a *CreatedByType pointing to the current value. -func (c CreatedByType) ToPtr() *CreatedByType { - return &c -} - // ImpactType - The impact type type ImpactType string @@ -62,11 +57,6 @@ func PossibleImpactTypeValues() []ImpactType { } } -// ToPtr returns a *ImpactType pointing to the current value. -func (c ImpactType) ToPtr() *ImpactType { - return &c -} - // MaintenanceScope - Gets or sets maintenanceScope of the configuration type MaintenanceScope string @@ -98,11 +88,6 @@ func PossibleMaintenanceScopeValues() []MaintenanceScope { } } -// ToPtr returns a *MaintenanceScope pointing to the current value. -func (c MaintenanceScope) ToPtr() *MaintenanceScope { - return &c -} - // RebootOptions - Possible reboot preference as defined by the user based on which it would be decided to reboot the machine // or not after the patch operation is completed. type RebootOptions string @@ -122,11 +107,6 @@ func PossibleRebootOptionsValues() []RebootOptions { } } -// ToPtr returns a *RebootOptions pointing to the current value. -func (c RebootOptions) ToPtr() *RebootOptions { - return &c -} - // TaskScope - Global Task execute once when schedule trigger. Resource task execute for each VM. type TaskScope string @@ -143,11 +123,6 @@ func PossibleTaskScopeValues() []TaskScope { } } -// ToPtr returns a *TaskScope pointing to the current value. -func (c TaskScope) ToPtr() *TaskScope { - return &c -} - // UpdateStatus - The status type UpdateStatus string @@ -175,11 +150,6 @@ func PossibleUpdateStatusValues() []UpdateStatus { } } -// ToPtr returns a *UpdateStatus pointing to the current value. -func (c UpdateStatus) ToPtr() *UpdateStatus { - return &c -} - // Visibility - Gets or sets the visibility of the configuration. The default value is 'Custom' type Visibility string @@ -197,8 +167,3 @@ func PossibleVisibilityValues() []Visibility { VisibilityPublic, } } - -// ToPtr returns a *Visibility pointing to the current value. -func (c Visibility) ToPtr() *Visibility { - return &c -} diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_models.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_models.go index 4e1445ef06ac..8a1b68df1132 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_models.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armmaintenance -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // ApplyUpdate - Apply Update request type ApplyUpdate struct { @@ -51,41 +46,6 @@ type ApplyUpdateProperties struct { Status *UpdateStatus `json:"status,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ApplyUpdateProperties. -func (a ApplyUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "lastUpdateTime", a.LastUpdateTime) - populate(objectMap, "resourceId", a.ResourceID) - populate(objectMap, "status", a.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ApplyUpdateProperties. -func (a *ApplyUpdateProperties) 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 "lastUpdateTime": - err = unpopulateTimeRFC3339(val, &a.LastUpdateTime) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, &a.ResourceID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, &a.Status) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ApplyUpdatesClientCreateOrUpdateOptions contains the optional parameters for the ApplyUpdatesClient.CreateOrUpdate method. type ApplyUpdatesClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -136,19 +96,6 @@ type Configuration struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Configuration. -func (c Configuration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - // ConfigurationAssignment - Configuration Assignment type ConfigurationAssignment struct { // Location of the resource @@ -253,18 +200,6 @@ type ConfigurationProperties struct { Visibility *Visibility `json:"visibility,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ConfigurationProperties. -func (c ConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "extensionProperties", c.ExtensionProperties) - populate(objectMap, "installPatches", c.InstallPatches) - populate(objectMap, "maintenanceScope", c.MaintenanceScope) - populate(objectMap, "maintenanceWindow", c.MaintenanceWindow) - populate(objectMap, "namespace", c.Namespace) - populate(objectMap, "visibility", c.Visibility) - return json.Marshal(objectMap) -} - // ConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the ConfigurationsClient.CreateOrUpdate // method. type ConfigurationsClientCreateOrUpdateOptions struct { @@ -324,15 +259,6 @@ type InputLinuxParameters struct { PackageNameMasksToInclude []*string `json:"packageNameMasksToInclude,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type InputLinuxParameters. -func (i InputLinuxParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "classificationsToInclude", i.ClassificationsToInclude) - populate(objectMap, "packageNameMasksToExclude", i.PackageNameMasksToExclude) - populate(objectMap, "packageNameMasksToInclude", i.PackageNameMasksToInclude) - return json.Marshal(objectMap) -} - // InputPatchConfiguration - Input configuration for a patch run type InputPatchConfiguration struct { // Input parameters specific to patching Linux machine. For Windows machines, do not pass this property. @@ -364,68 +290,30 @@ type InputWindowsParameters struct { KbNumbersToInclude []*string `json:"kbNumbersToInclude,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type InputWindowsParameters. -func (i InputWindowsParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "classificationsToInclude", i.ClassificationsToInclude) - populate(objectMap, "excludeKbsRequiringReboot", i.ExcludeKbsRequiringReboot) - populate(objectMap, "kbNumbersToExclude", i.KbNumbersToExclude) - populate(objectMap, "kbNumbersToInclude", i.KbNumbersToInclude) - return json.Marshal(objectMap) -} - // ListApplyUpdate - Response for ApplyUpdate list type ListApplyUpdate struct { // The list of apply updates Value []*ApplyUpdate `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ListApplyUpdate. -func (l ListApplyUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - // ListConfigurationAssignmentsResult - Response for ConfigurationAssignments list type ListConfigurationAssignmentsResult struct { // The list of configuration Assignments Value []*ConfigurationAssignment `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ListConfigurationAssignmentsResult. -func (l ListConfigurationAssignmentsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - // ListMaintenanceConfigurationsResult - Response for MaintenanceConfigurations list type ListMaintenanceConfigurationsResult struct { // The list of maintenance Configurations Value []*Configuration `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ListMaintenanceConfigurationsResult. -func (l ListMaintenanceConfigurationsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - // ListUpdatesResult - Response for Updates list type ListUpdatesResult struct { // The pending updates Value []*Update `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ListUpdatesResult. -func (l ListUpdatesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - // Operation - Represents an operation returned by the GetOperations request type Operation struct { // Display name of the operation @@ -441,7 +329,7 @@ type Operation struct { Origin *string `json:"origin,omitempty"` // Properties of the operation - Properties map[string]interface{} `json:"properties,omitempty"` + Properties interface{} `json:"properties,omitempty"` } // OperationInfo - Information about an operation @@ -470,13 +358,6 @@ type OperationsListResult struct { Value []*Operation `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OperationsListResult. -func (o OperationsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // PublicMaintenanceConfigurationsClientGetOptions contains the optional parameters for the PublicMaintenanceConfigurationsClient.Get // method. type PublicMaintenanceConfigurationsClientGetOptions struct { @@ -513,14 +394,6 @@ type SoftwareUpdateConfigurationTasks struct { PreTasks []*TaskProperties `json:"preTasks,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SoftwareUpdateConfigurationTasks. -func (s SoftwareUpdateConfigurationTasks) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "postTasks", s.PostTasks) - populate(objectMap, "preTasks", s.PreTasks) - return json.Marshal(objectMap) -} - // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -542,53 +415,6 @@ type SystemData struct { 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 -} - // TaskProperties - Task properties of the software update configuration. type TaskProperties struct { // Gets or sets the parameters of the task. @@ -601,15 +427,6 @@ type TaskProperties struct { TaskScope *TaskScope `json:"taskScope,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type TaskProperties. -func (t TaskProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "parameters", t.Parameters) - populate(objectMap, "source", t.Source) - populate(objectMap, "taskScope", t.TaskScope) - return json.Marshal(objectMap) -} - // Update - Maintenance update on a resource type Update struct { // Duration of impact in seconds @@ -631,53 +448,6 @@ type Update struct { Status *UpdateStatus `json:"status,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type Update. -func (u Update) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "impactDurationInSec", u.ImpactDurationInSec) - populate(objectMap, "impactType", u.ImpactType) - populate(objectMap, "maintenanceScope", u.MaintenanceScope) - populateTimeRFC3339(objectMap, "notBefore", u.NotBefore) - populate(objectMap, "properties", u.Properties) - populate(objectMap, "status", u.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Update. -func (u *Update) 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 "impactDurationInSec": - err = unpopulate(val, &u.ImpactDurationInSec) - delete(rawMsg, key) - case "impactType": - err = unpopulate(val, &u.ImpactType) - delete(rawMsg, key) - case "maintenanceScope": - err = unpopulate(val, &u.MaintenanceScope) - delete(rawMsg, key) - case "notBefore": - err = unpopulateTimeRFC3339(val, &u.NotBefore) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, &u.Properties) - delete(rawMsg, key) - case "status": - err = unpopulate(val, &u.Status) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // UpdateProperties - Properties for update type UpdateProperties struct { // The resourceId @@ -728,20 +498,3 @@ type Window struct { // Standard Time, Cen. Australia Standard Time. TimeZone *string `json:"timeZone,omitempty"` } - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_models_serde.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_models_serde.go new file mode 100644 index 000000000000..85ba8dcd982b --- /dev/null +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_models_serde.go @@ -0,0 +1,257 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmaintenance + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type ApplyUpdateProperties. +func (a ApplyUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "lastUpdateTime", a.LastUpdateTime) + populate(objectMap, "resourceId", a.ResourceID) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplyUpdateProperties. +func (a *ApplyUpdateProperties) 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 "lastUpdateTime": + err = unpopulateTimeRFC3339(val, &a.LastUpdateTime) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, &a.ResourceID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, &a.Status) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Configuration. +func (c Configuration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationProperties. +func (c ConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extensionProperties", c.ExtensionProperties) + populate(objectMap, "installPatches", c.InstallPatches) + populate(objectMap, "maintenanceScope", c.MaintenanceScope) + populate(objectMap, "maintenanceWindow", c.MaintenanceWindow) + populate(objectMap, "namespace", c.Namespace) + populate(objectMap, "visibility", c.Visibility) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type InputLinuxParameters. +func (i InputLinuxParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "classificationsToInclude", i.ClassificationsToInclude) + populate(objectMap, "packageNameMasksToExclude", i.PackageNameMasksToExclude) + populate(objectMap, "packageNameMasksToInclude", i.PackageNameMasksToInclude) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type InputWindowsParameters. +func (i InputWindowsParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "classificationsToInclude", i.ClassificationsToInclude) + populate(objectMap, "excludeKbsRequiringReboot", i.ExcludeKbsRequiringReboot) + populate(objectMap, "kbNumbersToExclude", i.KbNumbersToExclude) + populate(objectMap, "kbNumbersToInclude", i.KbNumbersToInclude) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ListApplyUpdate. +func (l ListApplyUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ListConfigurationAssignmentsResult. +func (l ListConfigurationAssignmentsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ListMaintenanceConfigurationsResult. +func (l ListMaintenanceConfigurationsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ListUpdatesResult. +func (l ListUpdatesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OperationsListResult. +func (o OperationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type SoftwareUpdateConfigurationTasks. +func (s SoftwareUpdateConfigurationTasks) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "postTasks", s.PostTasks) + populate(objectMap, "preTasks", s.PreTasks) + return json.Marshal(objectMap) +} + +// 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 +} + +// MarshalJSON implements the json.Marshaller interface for type TaskProperties. +func (t TaskProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "parameters", t.Parameters) + populate(objectMap, "source", t.Source) + populate(objectMap, "taskScope", t.TaskScope) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Update. +func (u Update) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "impactDurationInSec", u.ImpactDurationInSec) + populate(objectMap, "impactType", u.ImpactType) + populate(objectMap, "maintenanceScope", u.MaintenanceScope) + populateTimeRFC3339(objectMap, "notBefore", u.NotBefore) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "status", u.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Update. +func (u *Update) 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 "impactDurationInSec": + err = unpopulate(val, &u.ImpactDurationInSec) + delete(rawMsg, key) + case "impactType": + err = unpopulate(val, &u.ImpactType) + delete(rawMsg, key) + case "maintenanceScope": + err = unpopulate(val, &u.MaintenanceScope) + delete(rawMsg, key) + case "notBefore": + err = unpopulateTimeRFC3339(val, &u.NotBefore) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &u.Properties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, &u.Status) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_operations_client.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_operations_client.go index 0d389242f569..0e6f5de177e1 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_operations_client.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,37 +29,48 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - List the available operations supported by the Microsoft.Maintenance resource provider // If the operation fails it returns an *azcore.ResponseError type. // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(ctx context.Context, options *OperationsClientListOptions) (OperationsClientListResponse, error) { - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return OperationsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return OperationsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *OperationsClient) List(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -77,7 +89,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationsListResult); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_publicmaintenanceconfigurations_client.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_publicmaintenanceconfigurations_client.go index 654f91dadac6..1c5e8b744255 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_publicmaintenanceconfigurations_client.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_publicmaintenanceconfigurations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type PublicMaintenanceConfigurationsClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPublicMaintenanceConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PublicMaintenanceConfigurationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPublicMaintenanceConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PublicMaintenanceConfigurationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PublicMaintenanceConfigurationsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get Public Maintenance Configuration record @@ -94,7 +99,7 @@ func (client *PublicMaintenanceConfigurationsClient) getCreateRequest(ctx contex // getHandleResponse handles the Get response. func (client *PublicMaintenanceConfigurationsClient) getHandleResponse(resp *http.Response) (PublicMaintenanceConfigurationsClientGetResponse, error) { - result := PublicMaintenanceConfigurationsClientGetResponse{RawResponse: resp} + result := PublicMaintenanceConfigurationsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Configuration); err != nil { return PublicMaintenanceConfigurationsClientGetResponse{}, err } @@ -105,19 +110,26 @@ func (client *PublicMaintenanceConfigurationsClient) getHandleResponse(resp *htt // If the operation fails it returns an *azcore.ResponseError type. // options - PublicMaintenanceConfigurationsClientListOptions contains the optional parameters for the PublicMaintenanceConfigurationsClient.List // method. -func (client *PublicMaintenanceConfigurationsClient) List(ctx context.Context, options *PublicMaintenanceConfigurationsClientListOptions) (PublicMaintenanceConfigurationsClientListResponse, error) { - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return PublicMaintenanceConfigurationsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PublicMaintenanceConfigurationsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PublicMaintenanceConfigurationsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *PublicMaintenanceConfigurationsClient) List(options *PublicMaintenanceConfigurationsClientListOptions) *runtime.Pager[PublicMaintenanceConfigurationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[PublicMaintenanceConfigurationsClientListResponse]{ + More: func(page PublicMaintenanceConfigurationsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *PublicMaintenanceConfigurationsClientListResponse) (PublicMaintenanceConfigurationsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return PublicMaintenanceConfigurationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicMaintenanceConfigurationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicMaintenanceConfigurationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -140,7 +152,7 @@ func (client *PublicMaintenanceConfigurationsClient) listCreateRequest(ctx conte // listHandleResponse handles the List response. func (client *PublicMaintenanceConfigurationsClient) listHandleResponse(resp *http.Response) (PublicMaintenanceConfigurationsClientListResponse, error) { - result := PublicMaintenanceConfigurationsClientListResponse{RawResponse: resp} + result := PublicMaintenanceConfigurationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListMaintenanceConfigurationsResult); err != nil { return PublicMaintenanceConfigurationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_response_types.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_response_types.go index 94cd0934b895..6155a74c18be 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_response_types.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,316 +8,132 @@ package armmaintenance -import "net/http" - // ApplyUpdateForResourceGroupClientListResponse contains the response from method ApplyUpdateForResourceGroupClient.List. type ApplyUpdateForResourceGroupClientListResponse struct { - ApplyUpdateForResourceGroupClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ApplyUpdateForResourceGroupClientListResult contains the result from method ApplyUpdateForResourceGroupClient.List. -type ApplyUpdateForResourceGroupClientListResult struct { ListApplyUpdate } // ApplyUpdatesClientCreateOrUpdateParentResponse contains the response from method ApplyUpdatesClient.CreateOrUpdateParent. type ApplyUpdatesClientCreateOrUpdateParentResponse struct { - ApplyUpdatesClientCreateOrUpdateParentResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ApplyUpdatesClientCreateOrUpdateParentResult contains the result from method ApplyUpdatesClient.CreateOrUpdateParent. -type ApplyUpdatesClientCreateOrUpdateParentResult struct { ApplyUpdate } // ApplyUpdatesClientCreateOrUpdateResponse contains the response from method ApplyUpdatesClient.CreateOrUpdate. type ApplyUpdatesClientCreateOrUpdateResponse struct { - ApplyUpdatesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ApplyUpdatesClientCreateOrUpdateResult contains the result from method ApplyUpdatesClient.CreateOrUpdate. -type ApplyUpdatesClientCreateOrUpdateResult struct { ApplyUpdate } // ApplyUpdatesClientGetParentResponse contains the response from method ApplyUpdatesClient.GetParent. type ApplyUpdatesClientGetParentResponse struct { - ApplyUpdatesClientGetParentResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ApplyUpdatesClientGetParentResult contains the result from method ApplyUpdatesClient.GetParent. -type ApplyUpdatesClientGetParentResult struct { ApplyUpdate } // ApplyUpdatesClientGetResponse contains the response from method ApplyUpdatesClient.Get. type ApplyUpdatesClientGetResponse struct { - ApplyUpdatesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ApplyUpdatesClientGetResult contains the result from method ApplyUpdatesClient.Get. -type ApplyUpdatesClientGetResult struct { ApplyUpdate } // ApplyUpdatesClientListResponse contains the response from method ApplyUpdatesClient.List. type ApplyUpdatesClientListResponse struct { - ApplyUpdatesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ApplyUpdatesClientListResult contains the result from method ApplyUpdatesClient.List. -type ApplyUpdatesClientListResult struct { ListApplyUpdate } // ConfigurationAssignmentsClientCreateOrUpdateParentResponse contains the response from method ConfigurationAssignmentsClient.CreateOrUpdateParent. type ConfigurationAssignmentsClientCreateOrUpdateParentResponse struct { - ConfigurationAssignmentsClientCreateOrUpdateParentResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationAssignmentsClientCreateOrUpdateParentResult contains the result from method ConfigurationAssignmentsClient.CreateOrUpdateParent. -type ConfigurationAssignmentsClientCreateOrUpdateParentResult struct { ConfigurationAssignment } // ConfigurationAssignmentsClientCreateOrUpdateResponse contains the response from method ConfigurationAssignmentsClient.CreateOrUpdate. type ConfigurationAssignmentsClientCreateOrUpdateResponse struct { - ConfigurationAssignmentsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationAssignmentsClientCreateOrUpdateResult contains the result from method ConfigurationAssignmentsClient.CreateOrUpdate. -type ConfigurationAssignmentsClientCreateOrUpdateResult struct { ConfigurationAssignment } // ConfigurationAssignmentsClientDeleteParentResponse contains the response from method ConfigurationAssignmentsClient.DeleteParent. type ConfigurationAssignmentsClientDeleteParentResponse struct { - ConfigurationAssignmentsClientDeleteParentResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationAssignmentsClientDeleteParentResult contains the result from method ConfigurationAssignmentsClient.DeleteParent. -type ConfigurationAssignmentsClientDeleteParentResult struct { ConfigurationAssignment } // ConfigurationAssignmentsClientDeleteResponse contains the response from method ConfigurationAssignmentsClient.Delete. type ConfigurationAssignmentsClientDeleteResponse struct { - ConfigurationAssignmentsClientDeleteResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationAssignmentsClientDeleteResult contains the result from method ConfigurationAssignmentsClient.Delete. -type ConfigurationAssignmentsClientDeleteResult struct { ConfigurationAssignment } // ConfigurationAssignmentsClientGetParentResponse contains the response from method ConfigurationAssignmentsClient.GetParent. type ConfigurationAssignmentsClientGetParentResponse struct { - ConfigurationAssignmentsClientGetParentResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationAssignmentsClientGetParentResult contains the result from method ConfigurationAssignmentsClient.GetParent. -type ConfigurationAssignmentsClientGetParentResult struct { ConfigurationAssignment } // ConfigurationAssignmentsClientGetResponse contains the response from method ConfigurationAssignmentsClient.Get. type ConfigurationAssignmentsClientGetResponse struct { - ConfigurationAssignmentsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationAssignmentsClientGetResult contains the result from method ConfigurationAssignmentsClient.Get. -type ConfigurationAssignmentsClientGetResult struct { ConfigurationAssignment } // ConfigurationAssignmentsClientListParentResponse contains the response from method ConfigurationAssignmentsClient.ListParent. type ConfigurationAssignmentsClientListParentResponse struct { - ConfigurationAssignmentsClientListParentResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationAssignmentsClientListParentResult contains the result from method ConfigurationAssignmentsClient.ListParent. -type ConfigurationAssignmentsClientListParentResult struct { ListConfigurationAssignmentsResult } // ConfigurationAssignmentsClientListResponse contains the response from method ConfigurationAssignmentsClient.List. type ConfigurationAssignmentsClientListResponse struct { - ConfigurationAssignmentsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationAssignmentsClientListResult contains the result from method ConfigurationAssignmentsClient.List. -type ConfigurationAssignmentsClientListResult struct { ListConfigurationAssignmentsResult } // ConfigurationAssignmentsWithinSubscriptionClientListResponse contains the response from method ConfigurationAssignmentsWithinSubscriptionClient.List. type ConfigurationAssignmentsWithinSubscriptionClientListResponse struct { - ConfigurationAssignmentsWithinSubscriptionClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationAssignmentsWithinSubscriptionClientListResult contains the result from method ConfigurationAssignmentsWithinSubscriptionClient.List. -type ConfigurationAssignmentsWithinSubscriptionClientListResult struct { ListConfigurationAssignmentsResult } // ConfigurationsClientCreateOrUpdateResponse contains the response from method ConfigurationsClient.CreateOrUpdate. type ConfigurationsClientCreateOrUpdateResponse struct { - ConfigurationsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationsClientCreateOrUpdateResult contains the result from method ConfigurationsClient.CreateOrUpdate. -type ConfigurationsClientCreateOrUpdateResult struct { Configuration } // ConfigurationsClientDeleteResponse contains the response from method ConfigurationsClient.Delete. type ConfigurationsClientDeleteResponse struct { - ConfigurationsClientDeleteResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationsClientDeleteResult contains the result from method ConfigurationsClient.Delete. -type ConfigurationsClientDeleteResult struct { Configuration } // ConfigurationsClientGetResponse contains the response from method ConfigurationsClient.Get. type ConfigurationsClientGetResponse struct { - ConfigurationsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationsClientGetResult contains the result from method ConfigurationsClient.Get. -type ConfigurationsClientGetResult struct { Configuration } // ConfigurationsClientListResponse contains the response from method ConfigurationsClient.List. type ConfigurationsClientListResponse struct { - ConfigurationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationsClientListResult contains the result from method ConfigurationsClient.List. -type ConfigurationsClientListResult struct { ListMaintenanceConfigurationsResult } // ConfigurationsClientUpdateResponse contains the response from method ConfigurationsClient.Update. type ConfigurationsClientUpdateResponse struct { - ConfigurationsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationsClientUpdateResult contains the result from method ConfigurationsClient.Update. -type ConfigurationsClientUpdateResult struct { Configuration } // ConfigurationsForResourceGroupClientListResponse contains the response from method ConfigurationsForResourceGroupClient.List. type ConfigurationsForResourceGroupClientListResponse struct { - ConfigurationsForResourceGroupClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationsForResourceGroupClientListResult contains the result from method ConfigurationsForResourceGroupClient.List. -type ConfigurationsForResourceGroupClientListResult struct { ListMaintenanceConfigurationsResult } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationsListResult } // PublicMaintenanceConfigurationsClientGetResponse contains the response from method PublicMaintenanceConfigurationsClient.Get. type PublicMaintenanceConfigurationsClientGetResponse struct { - PublicMaintenanceConfigurationsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PublicMaintenanceConfigurationsClientGetResult contains the result from method PublicMaintenanceConfigurationsClient.Get. -type PublicMaintenanceConfigurationsClientGetResult struct { Configuration } // PublicMaintenanceConfigurationsClientListResponse contains the response from method PublicMaintenanceConfigurationsClient.List. type PublicMaintenanceConfigurationsClientListResponse struct { - PublicMaintenanceConfigurationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PublicMaintenanceConfigurationsClientListResult contains the result from method PublicMaintenanceConfigurationsClient.List. -type PublicMaintenanceConfigurationsClientListResult struct { ListMaintenanceConfigurationsResult } // UpdatesClientListParentResponse contains the response from method UpdatesClient.ListParent. type UpdatesClientListParentResponse struct { - UpdatesClientListParentResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// UpdatesClientListParentResult contains the result from method UpdatesClient.ListParent. -type UpdatesClientListParentResult struct { ListUpdatesResult } // UpdatesClientListResponse contains the response from method UpdatesClient.List. type UpdatesClientListResponse struct { - UpdatesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// UpdatesClientListResult contains the result from method UpdatesClient.List. -type UpdatesClientListResult struct { ListUpdatesResult } diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_time_rfc3339.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_time_rfc3339.go index 41c0ddb014b0..cc6f182e1ba8 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_updates_client.go b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_updates_client.go index 336c0569c52a..e984854cd9db 100644 --- a/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_updates_client.go +++ b/sdk/resourcemanager/maintenance/armmaintenance/zz_generated_updates_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type UpdatesClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewUpdatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UpdatesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewUpdatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpdatesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &UpdatesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Get updates to resources. @@ -57,19 +62,26 @@ func NewUpdatesClient(subscriptionID string, credential azcore.TokenCredential, // resourceType - Resource type // resourceName - Resource identifier // options - UpdatesClientListOptions contains the optional parameters for the UpdatesClient.List method. -func (client *UpdatesClient) List(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string, options *UpdatesClientListOptions) (UpdatesClientListResponse, error) { - req, err := client.listCreateRequest(ctx, resourceGroupName, providerName, resourceType, resourceName, options) - if err != nil { - return UpdatesClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return UpdatesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return UpdatesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *UpdatesClient) List(resourceGroupName string, providerName string, resourceType string, resourceName string, options *UpdatesClientListOptions) *runtime.Pager[UpdatesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[UpdatesClientListResponse]{ + More: func(page UpdatesClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *UpdatesClientListResponse) (UpdatesClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, providerName, resourceType, resourceName, options) + if err != nil { + return UpdatesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UpdatesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UpdatesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -108,7 +120,7 @@ func (client *UpdatesClient) listCreateRequest(ctx context.Context, resourceGrou // listHandleResponse handles the List response. func (client *UpdatesClient) listHandleResponse(resp *http.Response) (UpdatesClientListResponse, error) { - result := UpdatesClientListResponse{RawResponse: resp} + result := UpdatesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListUpdatesResult); err != nil { return UpdatesClientListResponse{}, err } @@ -124,19 +136,26 @@ func (client *UpdatesClient) listHandleResponse(resp *http.Response) (UpdatesCli // resourceType - Resource type // resourceName - Resource identifier // options - UpdatesClientListParentOptions contains the optional parameters for the UpdatesClient.ListParent method. -func (client *UpdatesClient) ListParent(ctx context.Context, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string, options *UpdatesClientListParentOptions) (UpdatesClientListParentResponse, error) { - req, err := client.listParentCreateRequest(ctx, resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, options) - if err != nil { - return UpdatesClientListParentResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return UpdatesClientListParentResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return UpdatesClientListParentResponse{}, runtime.NewResponseError(resp) - } - return client.listParentHandleResponse(resp) +func (client *UpdatesClient) ListParent(resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string, options *UpdatesClientListParentOptions) *runtime.Pager[UpdatesClientListParentResponse] { + return runtime.NewPager(runtime.PageProcessor[UpdatesClientListParentResponse]{ + More: func(page UpdatesClientListParentResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *UpdatesClientListParentResponse) (UpdatesClientListParentResponse, error) { + req, err := client.listParentCreateRequest(ctx, resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, options) + if err != nil { + return UpdatesClientListParentResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UpdatesClientListParentResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UpdatesClientListParentResponse{}, runtime.NewResponseError(resp) + } + return client.listParentHandleResponse(resp) + }, + }) } // listParentCreateRequest creates the ListParent request. @@ -183,7 +202,7 @@ func (client *UpdatesClient) listParentCreateRequest(ctx context.Context, resour // listParentHandleResponse handles the ListParent response. func (client *UpdatesClient) listParentHandleResponse(resp *http.Response) (UpdatesClientListParentResponse, error) { - result := UpdatesClientListParentResponse{RawResponse: resp} + result := UpdatesClientListParentResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListUpdatesResult); err != nil { return UpdatesClientListParentResponse{}, err } diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/CHANGELOG.md b/sdk/resourcemanager/managedservices/armmanagedservices/CHANGELOG.md index 44f17dd8915f..7c8eb4e87f54 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/CHANGELOG.md +++ b/sdk/resourcemanager/managedservices/armmanagedservices/CHANGELOG.md @@ -1,5 +1,139 @@ # Release History +## 0.3.0 (2022-04-12) +### Breaking Changes + +- Function `*MarketplaceRegistrationDefinitionsWithoutScopeClient.List` return value(s) have been changed from `(*MarketplaceRegistrationDefinitionsWithoutScopeClientListPager)` to `(*runtime.Pager[MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse])` +- Function `*RegistrationAssignmentsClient.BeginDelete` return value(s) have been changed from `(RegistrationAssignmentsClientDeletePollerResponse, error)` to `(*armruntime.Poller[RegistrationAssignmentsClientDeleteResponse], error)` +- Function `NewRegistrationDefinitionsClient` return value(s) have been changed from `(*RegistrationDefinitionsClient)` to `(*RegistrationDefinitionsClient, error)` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `*RegistrationAssignmentsClient.List` return value(s) have been changed from `(*RegistrationAssignmentsClientListPager)` to `(*runtime.Pager[RegistrationAssignmentsClientListResponse])` +- Function `*MarketplaceRegistrationDefinitionsClient.List` return value(s) have been changed from `(*MarketplaceRegistrationDefinitionsClientListPager)` to `(*runtime.Pager[MarketplaceRegistrationDefinitionsClientListResponse])` +- Function `*RegistrationDefinitionsClient.List` return value(s) have been changed from `(*RegistrationDefinitionsClientListPager)` to `(*runtime.Pager[RegistrationDefinitionsClientListResponse])` +- Function `NewMarketplaceRegistrationDefinitionsWithoutScopeClient` return value(s) have been changed from `(*MarketplaceRegistrationDefinitionsWithoutScopeClient)` to `(*MarketplaceRegistrationDefinitionsWithoutScopeClient, error)` +- Function `*RegistrationDefinitionsClient.BeginCreateOrUpdate` return value(s) have been changed from `(RegistrationDefinitionsClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[RegistrationDefinitionsClientCreateOrUpdateResponse], error)` +- Function `NewRegistrationAssignmentsClient` return value(s) have been changed from `(*RegistrationAssignmentsClient)` to `(*RegistrationAssignmentsClient, error)` +- Function `*RegistrationAssignmentsClient.BeginCreateOrUpdate` return value(s) have been changed from `(RegistrationAssignmentsClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[RegistrationAssignmentsClientCreateOrUpdateResponse], error)` +- Function `NewMarketplaceRegistrationDefinitionsClient` return value(s) have been changed from `(*MarketplaceRegistrationDefinitionsClient)` to `(*MarketplaceRegistrationDefinitionsClient, error)` +- Function `*RegistrationAssignmentsClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*RegistrationDefinitionsClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `RegistrationDefinitionsClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*MarketplaceRegistrationDefinitionsClientListPager.NextPage` has been removed +- Function `*RegistrationDefinitionsClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*RegistrationAssignmentsClientDeletePoller.Done` has been removed +- Function `*RegistrationDefinitionsClientListPager.NextPage` has been removed +- Function `*RegistrationDefinitionsClientListPager.Err` has been removed +- Function `*MarketplaceRegistrationDefinitionsWithoutScopeClientListPager.NextPage` has been removed +- Function `*MarketplaceRegistrationDefinitionsClientListPager.PageResponse` has been removed +- Function `*RegistrationAssignmentsClientDeletePoller.Poll` has been removed +- Function `*MarketplaceRegistrationDefinitionsWithoutScopeClientListPager.Err` has been removed +- Function `*RegistrationAssignmentsClientDeletePoller.ResumeToken` has been removed +- Function `*MarketplaceRegistrationDefinitionsWithoutScopeClientListPager.PageResponse` has been removed +- Function `ProvisioningState.ToPtr` has been removed +- Function `*RegistrationAssignmentsClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `MultiFactorAuthProvider.ToPtr` has been removed +- Function `*RegistrationAssignmentsClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*RegistrationAssignmentsClientListPager.NextPage` has been removed +- Function `*RegistrationAssignmentsClientDeletePoller.FinalResponse` has been removed +- Function `*RegistrationAssignmentsClientCreateOrUpdatePoller.Done` has been removed +- Function `*RegistrationDefinitionsClientCreateOrUpdatePoller.Poll` has been removed +- Function `*RegistrationDefinitionsClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `RegistrationAssignmentsClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*RegistrationAssignmentsClientListPager.Err` has been removed +- Function `*RegistrationDefinitionsClientListPager.PageResponse` has been removed +- Function `*RegistrationAssignmentsClientCreateOrUpdatePoller.Poll` has been removed +- Function `*RegistrationDefinitionsClientCreateOrUpdatePoller.Done` has been removed +- Function `*RegistrationAssignmentsClientDeletePollerResponse.Resume` has been removed +- Function `RegistrationAssignmentsClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*MarketplaceRegistrationDefinitionsClientListPager.Err` has been removed +- Function `*RegistrationAssignmentsClientListPager.PageResponse` has been removed +- Struct `MarketplaceRegistrationDefinitionsClientGetResult` has been removed +- Struct `MarketplaceRegistrationDefinitionsClientListPager` has been removed +- Struct `MarketplaceRegistrationDefinitionsClientListResult` has been removed +- Struct `MarketplaceRegistrationDefinitionsWithoutScopeClientGetResult` has been removed +- Struct `MarketplaceRegistrationDefinitionsWithoutScopeClientListPager` has been removed +- Struct `MarketplaceRegistrationDefinitionsWithoutScopeClientListResult` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `RegistrationAssignmentsClientCreateOrUpdatePoller` has been removed +- Struct `RegistrationAssignmentsClientCreateOrUpdatePollerResponse` has been removed +- Struct `RegistrationAssignmentsClientCreateOrUpdateResult` has been removed +- Struct `RegistrationAssignmentsClientDeletePoller` has been removed +- Struct `RegistrationAssignmentsClientDeletePollerResponse` has been removed +- Struct `RegistrationAssignmentsClientGetResult` has been removed +- Struct `RegistrationAssignmentsClientListPager` has been removed +- Struct `RegistrationAssignmentsClientListResult` has been removed +- Struct `RegistrationDefinitionsClientCreateOrUpdatePoller` has been removed +- Struct `RegistrationDefinitionsClientCreateOrUpdatePollerResponse` has been removed +- Struct `RegistrationDefinitionsClientCreateOrUpdateResult` has been removed +- Struct `RegistrationDefinitionsClientGetResult` has been removed +- Struct `RegistrationDefinitionsClientListPager` has been removed +- Struct `RegistrationDefinitionsClientListResult` has been removed +- Field `RegistrationDefinitionsClientListResult` of struct `RegistrationDefinitionsClientListResponse` has been removed +- Field `RawResponse` of struct `RegistrationDefinitionsClientListResponse` has been removed +- Field `RawResponse` of struct `RegistrationDefinitionsClientDeleteResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `RegistrationAssignmentsClientGetResult` of struct `RegistrationAssignmentsClientGetResponse` has been removed +- Field `RawResponse` of struct `RegistrationAssignmentsClientGetResponse` has been removed +- Field `RegistrationAssignmentsClientCreateOrUpdateResult` of struct `RegistrationAssignmentsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `RegistrationAssignmentsClientCreateOrUpdateResponse` has been removed +- Field `MarketplaceRegistrationDefinitionsClientListResult` of struct `MarketplaceRegistrationDefinitionsClientListResponse` has been removed +- Field `RawResponse` of struct `MarketplaceRegistrationDefinitionsClientListResponse` has been removed +- Field `RegistrationAssignmentsClientListResult` of struct `RegistrationAssignmentsClientListResponse` has been removed +- Field `RawResponse` of struct `RegistrationAssignmentsClientListResponse` has been removed +- Field `RegistrationDefinitionsClientCreateOrUpdateResult` of struct `RegistrationDefinitionsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `RegistrationDefinitionsClientCreateOrUpdateResponse` has been removed +- Field `RegistrationDefinitionsClientGetResult` of struct `RegistrationDefinitionsClientGetResponse` has been removed +- Field `RawResponse` of struct `RegistrationDefinitionsClientGetResponse` has been removed +- Field `MarketplaceRegistrationDefinitionsWithoutScopeClientListResult` of struct `MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse` has been removed +- Field `RawResponse` of struct `MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse` has been removed +- Field `MarketplaceRegistrationDefinitionsClientGetResult` of struct `MarketplaceRegistrationDefinitionsClientGetResponse` has been removed +- Field `RawResponse` of struct `MarketplaceRegistrationDefinitionsClientGetResponse` has been removed +- Field `MarketplaceRegistrationDefinitionsWithoutScopeClientGetResult` of struct `MarketplaceRegistrationDefinitionsWithoutScopeClientGetResponse` has been removed +- Field `RawResponse` of struct `MarketplaceRegistrationDefinitionsWithoutScopeClientGetResponse` has been removed +- Field `RawResponse` of struct `RegistrationAssignmentsClientDeleteResponse` has been removed + +### Features Added + +- New const `CreatedByTypeUser` +- New const `CreatedByTypeKey` +- New const `CreatedByTypeManagedIdentity` +- New const `CreatedByTypeApplication` +- New function `timeRFC3339.MarshalJSON() ([]byte, error)` +- New function `*timeRFC3339.UnmarshalText([]byte) error` +- New function `PossibleCreatedByTypeValues() []CreatedByType` +- New function `*OperationsWithScopeClient.List(context.Context, string, *OperationsWithScopeClientListOptions) (OperationsWithScopeClientListResponse, error)` +- New function `timeRFC3339.MarshalText() ([]byte, error)` +- New function `*timeRFC3339.Parse(string) error` +- New function `*SystemData.UnmarshalJSON([]byte) error` +- New function `*timeRFC3339.UnmarshalJSON([]byte) error` +- New function `NewOperationsWithScopeClient(azcore.TokenCredential, *arm.ClientOptions) (*OperationsWithScopeClient, error)` +- New function `SystemData.MarshalJSON() ([]byte, error)` +- New struct `OperationsWithScopeClient` +- New struct `OperationsWithScopeClientListOptions` +- New struct `OperationsWithScopeClientListResponse` +- New struct `SystemData` +- New field `SystemData` in struct `RegistrationAssignmentPropertiesRegistrationDefinition` +- New anonymous field `RegistrationAssignment` in struct `RegistrationAssignmentsClientGetResponse` +- New anonymous field `RegistrationDefinition` in struct `RegistrationDefinitionsClientGetResponse` +- New field `SystemData` in struct `RegistrationDefinition` +- New anonymous field `MarketplaceRegistrationDefinitionList` in struct `MarketplaceRegistrationDefinitionsClientListResponse` +- New field `ResumeToken` in struct `RegistrationAssignmentsClientBeginDeleteOptions` +- New anonymous field `RegistrationAssignment` in struct `RegistrationAssignmentsClientCreateOrUpdateResponse` +- New anonymous field `MarketplaceRegistrationDefinitionList` in struct `MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse` +- New anonymous field `MarketplaceRegistrationDefinition` in struct `MarketplaceRegistrationDefinitionsClientGetResponse` +- New field `ResumeToken` in struct `RegistrationDefinitionsClientBeginCreateOrUpdateOptions` +- New anonymous field `OperationList` in struct `OperationsClientListResponse` +- New field `Filter` in struct `RegistrationDefinitionsClientListOptions` +- New anonymous field `RegistrationDefinition` in struct `RegistrationDefinitionsClientCreateOrUpdateResponse` +- New anonymous field `RegistrationAssignmentList` in struct `RegistrationAssignmentsClientListResponse` +- New anonymous field `RegistrationDefinitionList` in struct `RegistrationDefinitionsClientListResponse` +- New field `ResumeToken` in struct `RegistrationAssignmentsClientBeginCreateOrUpdateOptions` +- New anonymous field `MarketplaceRegistrationDefinition` in struct `MarketplaceRegistrationDefinitionsWithoutScopeClientGetResponse` +- New field `SystemData` in struct `RegistrationAssignment` +- New field `Filter` in struct `RegistrationAssignmentsClientListOptions` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/README.md b/sdk/resourcemanager/managedservices/armmanagedservices/README.md index 6f8466b82582..ce298252944e 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/README.md +++ b/sdk/resourcemanager/managedservices/armmanagedservices/README.md @@ -11,7 +11,7 @@ The `armmanagedservices` module provides operations for working with Azure Manag ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Managed 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 -client := armmanagedservices.(, cred, nil) +client, err := armmanagedservices.(, cred, nil) ``` 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 -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armmanagedservices.(, cred, &options) +client, err := armmanagedservices.(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/autorest.md b/sdk/resourcemanager/managedservices/armmanagedservices/autorest.md index afb7caf4f59e..62e5044dd12c 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/autorest.md +++ b/sdk/resourcemanager/managedservices/armmanagedservices/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/managedservices/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/managedservices/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/managedservices/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/managedservices/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/go.mod b/sdk/resourcemanager/managedservices/armmanagedservices/go.mod index d166d869d93e..5dd9215b144a 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/go.mod +++ b/sdk/resourcemanager/managedservices/armmanagedservices/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managedservices/armmanagedservices -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/go.sum b/sdk/resourcemanager/managedservices/armmanagedservices/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/go.sum +++ b/sdk/resourcemanager/managedservices/armmanagedservices/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm 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/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/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-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_marketplaceregistrationdefinitions_client_test.go b/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_marketplaceregistrationdefinitions_client_test.go index d238bd10d346..48070ab7f780 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_marketplaceregistrationdefinitions_client_test.go +++ b/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_marketplaceregistrationdefinitions_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,44 +17,55 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managedservices/armmanagedservices" ) -// x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2020-02-01-preview/examples/GetMarketplaceRegistrationDefinitions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/GetMarketplaceRegistrationDefinitions.json func ExampleMarketplaceRegistrationDefinitionsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagedservices.NewMarketplaceRegistrationDefinitionsClient(cred, nil) + client, err := armmanagedservices.NewMarketplaceRegistrationDefinitionsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", - &armmanagedservices.MarketplaceRegistrationDefinitionsClientListOptions{Filter: to.StringPtr("")}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + &armmanagedservices.MarketplaceRegistrationDefinitionsClientListOptions{Filter: to.Ptr("")}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2020-02-01-preview/examples/GetMarketplaceRegistrationDefinition.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/GetMarketplaceRegistrationDefinition.json func ExampleMarketplaceRegistrationDefinitionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagedservices.NewMarketplaceRegistrationDefinitionsClient(cred, nil) + client, err := armmanagedservices.NewMarketplaceRegistrationDefinitionsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.MarketplaceRegistrationDefinitionsClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_marketplaceregistrationdefinitionswithoutscope_client_test.go b/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_marketplaceregistrationdefinitionswithoutscope_client_test.go index dc0516946a79..bb32aa12e76d 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_marketplaceregistrationdefinitionswithoutscope_client_test.go +++ b/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_marketplaceregistrationdefinitionswithoutscope_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,42 +17,53 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managedservices/armmanagedservices" ) -// x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2020-02-01-preview/examples/GetMarketplaceRegistrationDefinitionsAtTenantScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/GetMarketplaceRegistrationDefinitionsAtTenantScope.json func ExampleMarketplaceRegistrationDefinitionsWithoutScopeClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagedservices.NewMarketplaceRegistrationDefinitionsWithoutScopeClient(cred, nil) - pager := client.List(&armmanagedservices.MarketplaceRegistrationDefinitionsWithoutScopeClientListOptions{Filter: to.StringPtr("")}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + client, err := armmanagedservices.NewMarketplaceRegistrationDefinitionsWithoutScopeClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List(&armmanagedservices.MarketplaceRegistrationDefinitionsWithoutScopeClientListOptions{Filter: to.Ptr("")}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2020-02-01-preview/examples/GetMarketplaceRegistrationDefinitionAtTenantScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/GetMarketplaceRegistrationDefinitionAtTenantScope.json func ExampleMarketplaceRegistrationDefinitionsWithoutScopeClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagedservices.NewMarketplaceRegistrationDefinitionsWithoutScopeClient(cred, nil) + client, err := armmanagedservices.NewMarketplaceRegistrationDefinitionsWithoutScopeClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.MarketplaceRegistrationDefinitionsWithoutScopeClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_operations_client_test.go index 6109f57d85fc..fce739274013 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_operations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,18 +16,25 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managedservices/armmanagedservices" ) -// x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2020-02-01-preview/examples/GetOperations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/GetOperations.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagedservices.NewOperationsClient(cred, nil) + client, err := armmanagedservices.NewOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.OperationsClientListResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_operationswithscope_client_test.go b/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_operationswithscope_client_test.go new file mode 100644 index 000000000000..260dd6e97d77 --- /dev/null +++ b/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_operationswithscope_client_test.go @@ -0,0 +1,41 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmanagedservices_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managedservices/armmanagedservices" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/GetOperationsWithScope.json +func ExampleOperationsWithScopeClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + return + } + ctx := context.Background() + client, err := armmanagedservices.NewOperationsWithScopeClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + res, err := client.List(ctx, + "", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + return + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_registrationassignments_client_test.go b/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_registrationassignments_client_test.go index 65d8df638ef8..fb885c801926 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_registrationassignments_client_test.go +++ b/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_registrationassignments_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,92 +19,120 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managedservices/armmanagedservices" ) -// x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2020-02-01-preview/examples/GetRegistrationAssignment.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/GetRegistrationAssignment.json func ExampleRegistrationAssignmentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagedservices.NewRegistrationAssignmentsClient(cred, nil) + client, err := armmanagedservices.NewRegistrationAssignmentsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", &armmanagedservices.RegistrationAssignmentsClientGetOptions{ExpandRegistrationDefinition: nil}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.RegistrationAssignmentsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2020-02-01-preview/examples/DeleteRegistrationAssignment.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/DeleteRegistrationAssignment.json func ExampleRegistrationAssignmentsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagedservices.NewRegistrationAssignmentsClient(cred, nil) + client, err := armmanagedservices.NewRegistrationAssignmentsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "", "", - nil) + &armmanagedservices.RegistrationAssignmentsClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2020-02-01-preview/examples/PutRegistrationAssignment.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/PutRegistrationAssignment.json func ExampleRegistrationAssignmentsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagedservices.NewRegistrationAssignmentsClient(cred, nil) + client, err := armmanagedservices.NewRegistrationAssignmentsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "", "", armmanagedservices.RegistrationAssignment{ Properties: &armmanagedservices.RegistrationAssignmentProperties{ - RegistrationDefinitionID: to.StringPtr(""), + RegistrationDefinitionID: to.Ptr(""), }, }, - nil) + &armmanagedservices.RegistrationAssignmentsClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.RegistrationAssignmentsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2020-02-01-preview/examples/GetRegistrationAssignments.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/GetRegistrationAssignments.json func ExampleRegistrationAssignmentsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagedservices.NewRegistrationAssignmentsClient(cred, nil) + client, err := armmanagedservices.NewRegistrationAssignmentsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", - &armmanagedservices.RegistrationAssignmentsClientListOptions{ExpandRegistrationDefinition: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + &armmanagedservices.RegistrationAssignmentsClientListOptions{ExpandRegistrationDefinition: nil, + Filter: nil, + }) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_registrationdefinitions_client_test.go b/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_registrationdefinitions_client_test.go index 68907a86e517..98e8f3cdbdde 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_registrationdefinitions_client_test.go +++ b/sdk/resourcemanager/managedservices/armmanagedservices/ze_generated_example_registrationdefinitions_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,124 +19,149 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managedservices/armmanagedservices" ) -// x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2020-02-01-preview/examples/GetRegistrationDefinition.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/GetRegistrationDefinition.json func ExampleRegistrationDefinitionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagedservices.NewRegistrationDefinitionsClient(cred, nil) + client, err := armmanagedservices.NewRegistrationDefinitionsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.RegistrationDefinitionsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2020-02-01-preview/examples/DeleteRegistrationDefinition.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/DeleteRegistrationDefinition.json func ExampleRegistrationDefinitionsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagedservices.NewRegistrationDefinitionsClient(cred, nil) + client, err := armmanagedservices.NewRegistrationDefinitionsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2020-02-01-preview/examples/PutRegistrationDefinition.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/PutRegistrationDefinition.json func ExampleRegistrationDefinitionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagedservices.NewRegistrationDefinitionsClient(cred, nil) + client, err := armmanagedservices.NewRegistrationDefinitionsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "", "", armmanagedservices.RegistrationDefinition{ Plan: &armmanagedservices.Plan{ - Name: to.StringPtr(""), - Product: to.StringPtr(""), - Publisher: to.StringPtr(""), - Version: to.StringPtr(""), + Name: to.Ptr(""), + Product: to.Ptr(""), + Publisher: to.Ptr(""), + Version: to.Ptr(""), }, Properties: &armmanagedservices.RegistrationDefinitionProperties{ - Description: to.StringPtr(""), + Description: to.Ptr(""), Authorizations: []*armmanagedservices.Authorization{ { - PrincipalID: to.StringPtr(""), - PrincipalIDDisplayName: to.StringPtr(""), - RoleDefinitionID: to.StringPtr(""), + PrincipalID: to.Ptr(""), + PrincipalIDDisplayName: to.Ptr(""), + RoleDefinitionID: to.Ptr(""), }, { DelegatedRoleDefinitionIDs: []*string{ - to.StringPtr("b24988ac-6180-42a0-ab88-20f7382dd24c")}, - PrincipalID: to.StringPtr(""), - PrincipalIDDisplayName: to.StringPtr(""), - RoleDefinitionID: to.StringPtr(""), + to.Ptr("b24988ac-6180-42a0-ab88-20f7382dd24c")}, + PrincipalID: to.Ptr(""), + PrincipalIDDisplayName: to.Ptr(""), + RoleDefinitionID: to.Ptr(""), }}, EligibleAuthorizations: []*armmanagedservices.EligibleAuthorization{ { JustInTimeAccessPolicy: &armmanagedservices.JustInTimeAccessPolicy{ ManagedByTenantApprovers: []*armmanagedservices.EligibleApprover{ { - PrincipalID: to.StringPtr(""), - PrincipalIDDisplayName: to.StringPtr(""), + PrincipalID: to.Ptr(""), + PrincipalIDDisplayName: to.Ptr(""), }}, - MaximumActivationDuration: to.StringPtr(""), - MultiFactorAuthProvider: armmanagedservices.MultiFactorAuthProvider("Azure").ToPtr(), + MaximumActivationDuration: to.Ptr(""), + MultiFactorAuthProvider: to.Ptr(armmanagedservices.MultiFactorAuthProviderAzure), }, - PrincipalID: to.StringPtr(""), - PrincipalIDDisplayName: to.StringPtr(""), - RoleDefinitionID: to.StringPtr(""), + PrincipalID: to.Ptr(""), + PrincipalIDDisplayName: to.Ptr(""), + RoleDefinitionID: to.Ptr(""), }}, - ManagedByTenantID: to.StringPtr(""), - RegistrationDefinitionName: to.StringPtr(""), + ManagedByTenantID: to.Ptr(""), + RegistrationDefinitionName: to.Ptr(""), }, }, - nil) + &armmanagedservices.RegistrationDefinitionsClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.RegistrationDefinitionsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2020-02-01-preview/examples/GetRegistrationDefinitions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managedservices/resource-manager/Microsoft.ManagedServices/preview/2022-01-01-preview/examples/GetRegistrationDefinitions.json func ExampleRegistrationDefinitionsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagedservices.NewRegistrationDefinitionsClient(cred, nil) + client, err := armmanagedservices.NewRegistrationDefinitionsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + &armmanagedservices.RegistrationDefinitionsClientListOptions{Filter: nil}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_constants.go b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_constants.go index 8600071a2f9b..a799c32d7ab7 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_constants.go +++ b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,9 +10,29 @@ package armmanagedservices const ( moduleName = "armmanagedservices" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) +// 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, + } +} + // MultiFactorAuthProvider - The multi-factor authorization provider to be used for just-in-time access requests. type MultiFactorAuthProvider string @@ -29,11 +49,6 @@ func PossibleMultiFactorAuthProviderValues() []MultiFactorAuthProvider { } } -// ToPtr returns a *MultiFactorAuthProvider pointing to the current value. -func (c MultiFactorAuthProvider) ToPtr() *MultiFactorAuthProvider { - return &c -} - // ProvisioningState - The current provisioning state of the registration definition. type ProvisioningState string @@ -69,8 +84,3 @@ func PossibleProvisioningStateValues() []ProvisioningState { ProvisioningStateUpdating, } } - -// ToPtr returns a *ProvisioningState pointing to the current value. -func (c ProvisioningState) ToPtr() *ProvisioningState { - return &c -} diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_marketplaceregistrationdefinitions_client.go b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_marketplaceregistrationdefinitions_client.go index db42b1c98c41..74cc289cb367 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_marketplaceregistrationdefinitions_client.go +++ b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_marketplaceregistrationdefinitions_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -31,19 +32,23 @@ type MarketplaceRegistrationDefinitionsClient struct { // NewMarketplaceRegistrationDefinitionsClient creates a new instance of MarketplaceRegistrationDefinitionsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewMarketplaceRegistrationDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *MarketplaceRegistrationDefinitionsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewMarketplaceRegistrationDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*MarketplaceRegistrationDefinitionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &MarketplaceRegistrationDefinitionsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get the marketplace registration definition for the marketplace identifier. @@ -82,7 +87,7 @@ func (client *MarketplaceRegistrationDefinitionsClient) getCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-02-01-preview") + reqQP.Set("api-version", "2022-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -90,7 +95,7 @@ func (client *MarketplaceRegistrationDefinitionsClient) getCreateRequest(ctx con // getHandleResponse handles the Get response. func (client *MarketplaceRegistrationDefinitionsClient) getHandleResponse(resp *http.Response) (MarketplaceRegistrationDefinitionsClientGetResponse, error) { - result := MarketplaceRegistrationDefinitionsClientGetResponse{RawResponse: resp} + result := MarketplaceRegistrationDefinitionsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.MarketplaceRegistrationDefinition); err != nil { return MarketplaceRegistrationDefinitionsClientGetResponse{}, err } @@ -102,16 +107,32 @@ func (client *MarketplaceRegistrationDefinitionsClient) getHandleResponse(resp * // scope - The scope of the resource. // options - MarketplaceRegistrationDefinitionsClientListOptions contains the optional parameters for the MarketplaceRegistrationDefinitionsClient.List // method. -func (client *MarketplaceRegistrationDefinitionsClient) List(scope string, options *MarketplaceRegistrationDefinitionsClientListOptions) *MarketplaceRegistrationDefinitionsClientListPager { - return &MarketplaceRegistrationDefinitionsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, scope, options) +func (client *MarketplaceRegistrationDefinitionsClient) List(scope string, options *MarketplaceRegistrationDefinitionsClientListOptions) *runtime.Pager[MarketplaceRegistrationDefinitionsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[MarketplaceRegistrationDefinitionsClientListResponse]{ + More: func(page MarketplaceRegistrationDefinitionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp MarketplaceRegistrationDefinitionsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.MarketplaceRegistrationDefinitionList.NextLink) + Fetcher: func(ctx context.Context, page *MarketplaceRegistrationDefinitionsClientListResponse) (MarketplaceRegistrationDefinitionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return MarketplaceRegistrationDefinitionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MarketplaceRegistrationDefinitionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MarketplaceRegistrationDefinitionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -126,7 +147,7 @@ func (client *MarketplaceRegistrationDefinitionsClient) listCreateRequest(ctx co if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-02-01-preview") + reqQP.Set("api-version", "2022-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -134,7 +155,7 @@ func (client *MarketplaceRegistrationDefinitionsClient) listCreateRequest(ctx co // listHandleResponse handles the List response. func (client *MarketplaceRegistrationDefinitionsClient) listHandleResponse(resp *http.Response) (MarketplaceRegistrationDefinitionsClientListResponse, error) { - result := MarketplaceRegistrationDefinitionsClientListResponse{RawResponse: resp} + result := MarketplaceRegistrationDefinitionsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.MarketplaceRegistrationDefinitionList); err != nil { return MarketplaceRegistrationDefinitionsClientListResponse{}, err } diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_marketplaceregistrationdefinitionswithoutscope_client.go b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_marketplaceregistrationdefinitionswithoutscope_client.go index 5b99ee45540d..34caa48ee532 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_marketplaceregistrationdefinitionswithoutscope_client.go +++ b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_marketplaceregistrationdefinitionswithoutscope_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -31,19 +32,23 @@ type MarketplaceRegistrationDefinitionsWithoutScopeClient struct { // NewMarketplaceRegistrationDefinitionsWithoutScopeClient creates a new instance of MarketplaceRegistrationDefinitionsWithoutScopeClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewMarketplaceRegistrationDefinitionsWithoutScopeClient(credential azcore.TokenCredential, options *arm.ClientOptions) *MarketplaceRegistrationDefinitionsWithoutScopeClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewMarketplaceRegistrationDefinitionsWithoutScopeClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*MarketplaceRegistrationDefinitionsWithoutScopeClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &MarketplaceRegistrationDefinitionsWithoutScopeClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get the marketplace registration definition for the marketplace identifier. @@ -80,7 +85,7 @@ func (client *MarketplaceRegistrationDefinitionsWithoutScopeClient) getCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-02-01-preview") + reqQP.Set("api-version", "2022-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -88,7 +93,7 @@ func (client *MarketplaceRegistrationDefinitionsWithoutScopeClient) getCreateReq // getHandleResponse handles the Get response. func (client *MarketplaceRegistrationDefinitionsWithoutScopeClient) getHandleResponse(resp *http.Response) (MarketplaceRegistrationDefinitionsWithoutScopeClientGetResponse, error) { - result := MarketplaceRegistrationDefinitionsWithoutScopeClientGetResponse{RawResponse: resp} + result := MarketplaceRegistrationDefinitionsWithoutScopeClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.MarketplaceRegistrationDefinition); err != nil { return MarketplaceRegistrationDefinitionsWithoutScopeClientGetResponse{}, err } @@ -99,16 +104,32 @@ func (client *MarketplaceRegistrationDefinitionsWithoutScopeClient) getHandleRes // If the operation fails it returns an *azcore.ResponseError type. // options - MarketplaceRegistrationDefinitionsWithoutScopeClientListOptions contains the optional parameters for the MarketplaceRegistrationDefinitionsWithoutScopeClient.List // method. -func (client *MarketplaceRegistrationDefinitionsWithoutScopeClient) List(options *MarketplaceRegistrationDefinitionsWithoutScopeClientListOptions) *MarketplaceRegistrationDefinitionsWithoutScopeClientListPager { - return &MarketplaceRegistrationDefinitionsWithoutScopeClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *MarketplaceRegistrationDefinitionsWithoutScopeClient) List(options *MarketplaceRegistrationDefinitionsWithoutScopeClientListOptions) *runtime.Pager[MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse]{ + More: func(page MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.MarketplaceRegistrationDefinitionList.NextLink) + Fetcher: func(ctx context.Context, page *MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse) (MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -122,7 +143,7 @@ func (client *MarketplaceRegistrationDefinitionsWithoutScopeClient) listCreateRe if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-02-01-preview") + reqQP.Set("api-version", "2022-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -130,7 +151,7 @@ func (client *MarketplaceRegistrationDefinitionsWithoutScopeClient) listCreateRe // listHandleResponse handles the List response. func (client *MarketplaceRegistrationDefinitionsWithoutScopeClient) listHandleResponse(resp *http.Response) (MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse, error) { - result := MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse{RawResponse: resp} + result := MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.MarketplaceRegistrationDefinitionList); err != nil { return MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse{}, err } diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_models.go b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_models.go index d19ce1983eae..8ee85b95af30 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_models.go +++ b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,11 +8,7 @@ package armmanagedservices -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) +import "time" // Authorization - The Azure Active Directory principal identifier and Azure built-in role that describes the access the principal // will receive on the delegated resource in the managed tenant. @@ -33,16 +29,6 @@ type Authorization struct { PrincipalIDDisplayName *string `json:"principalIdDisplayName,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type Authorization. -func (a Authorization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "delegatedRoleDefinitionIds", a.DelegatedRoleDefinitionIDs) - populate(objectMap, "principalId", a.PrincipalID) - populate(objectMap, "principalIdDisplayName", a.PrincipalIDDisplayName) - populate(objectMap, "roleDefinitionId", a.RoleDefinitionID) - return json.Marshal(objectMap) -} - // EligibleApprover - Defines the Azure Active Directory principal that can approve any just-in-time access requests by the // principal defined in the EligibleAuthorization. type EligibleApprover struct { @@ -83,15 +69,6 @@ type ErrorDefinition struct { Details []*ErrorDefinition `json:"details,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. -func (e ErrorDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - return json.Marshal(objectMap) -} - // ErrorResponse - Error response. type ErrorResponse struct { // The error details. @@ -110,15 +87,6 @@ type JustInTimeAccessPolicy struct { MaximumActivationDuration *string `json:"maximumActivationDuration,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type JustInTimeAccessPolicy. -func (j JustInTimeAccessPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "managedByTenantApprovers", j.ManagedByTenantApprovers) - populate(objectMap, "maximumActivationDuration", j.MaximumActivationDuration) - populate(objectMap, "multiFactorAuthProvider", j.MultiFactorAuthProvider) - return json.Marshal(objectMap) -} - type MarketplaceRegistrationDefinition struct { // The details for the Managed Services offer’s plan in Azure Marketplace. Plan *Plan `json:"plan,omitempty"` @@ -145,14 +113,6 @@ type MarketplaceRegistrationDefinitionList struct { Value []*MarketplaceRegistrationDefinition `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceRegistrationDefinitionList. -func (m MarketplaceRegistrationDefinitionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", m.NextLink) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - // MarketplaceRegistrationDefinitionProperties - The properties of the marketplace registration definition. type MarketplaceRegistrationDefinitionProperties struct { // REQUIRED; The collection of authorization objects describing the access Azure Active Directory principals in the managedBy @@ -177,18 +137,6 @@ type MarketplaceRegistrationDefinitionProperties struct { PublisherDisplayName *string `json:"publisherDisplayName,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceRegistrationDefinitionProperties. -func (m MarketplaceRegistrationDefinitionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authorizations", m.Authorizations) - populate(objectMap, "eligibleAuthorizations", m.EligibleAuthorizations) - populate(objectMap, "managedByTenantId", m.ManagedByTenantID) - populate(objectMap, "offerDisplayName", m.OfferDisplayName) - populate(objectMap, "planDisplayName", m.PlanDisplayName) - populate(objectMap, "publisherDisplayName", m.PublisherDisplayName) - return json.Marshal(objectMap) -} - // MarketplaceRegistrationDefinitionsClientGetOptions contains the optional parameters for the MarketplaceRegistrationDefinitionsClient.Get // method. type MarketplaceRegistrationDefinitionsClientGetOptions struct { @@ -198,7 +146,7 @@ type MarketplaceRegistrationDefinitionsClientGetOptions struct { // MarketplaceRegistrationDefinitionsClientListOptions contains the optional parameters for the MarketplaceRegistrationDefinitionsClient.List // method. type MarketplaceRegistrationDefinitionsClientListOptions struct { - // The filter query parameter to filter marketplace registration definitions by plan identifier, publisher, version etc. + // The filter query parameter to filter managed services resources by. Filter *string } @@ -211,7 +159,7 @@ type MarketplaceRegistrationDefinitionsWithoutScopeClientGetOptions struct { // MarketplaceRegistrationDefinitionsWithoutScopeClientListOptions contains the optional parameters for the MarketplaceRegistrationDefinitionsWithoutScopeClient.List // method. type MarketplaceRegistrationDefinitionsWithoutScopeClientListOptions struct { - // The filter query parameter to filter marketplace registration definitions by plan identifier, publisher, version etc. + // The filter query parameter to filter managed services resources by. Filter *string } @@ -245,18 +193,16 @@ type OperationList struct { Value []*Operation `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type OperationList. -func (o OperationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters } +// OperationsWithScopeClientListOptions contains the optional parameters for the OperationsWithScopeClient.List method. +type OperationsWithScopeClientListOptions struct { + // placeholder for future optional parameters +} + // Plan - The details for the Managed Services offer’s plan in Azure Marketplace. type Plan struct { // REQUIRED; Azure Marketplace plan name. @@ -283,6 +229,9 @@ type RegistrationAssignment struct { // READ-ONLY; The name of the registration assignment. Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; The metadata for the registration assignment resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the Azure resource (Microsoft.ManagedServices/registrationAssignments). Type *string `json:"type,omitempty" azure:"ro"` } @@ -296,14 +245,6 @@ type RegistrationAssignmentList struct { Value []*RegistrationAssignment `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type RegistrationAssignmentList. -func (r RegistrationAssignmentList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - // RegistrationAssignmentProperties - The properties of the registration assignment. type RegistrationAssignmentProperties struct { // REQUIRED; The fully qualified path of the registration definition. @@ -330,6 +271,9 @@ type RegistrationAssignmentPropertiesRegistrationDefinition struct { // READ-ONLY; The name of the registration definition. Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; The metadata for the registration definition resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the Azure resource (Microsoft.ManagedServices/registrationDefinitions). Type *string `json:"type,omitempty" azure:"ro"` } @@ -368,31 +312,18 @@ type RegistrationAssignmentPropertiesRegistrationDefinitionProperties struct { RegistrationDefinitionName *string `json:"registrationDefinitionName,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type RegistrationAssignmentPropertiesRegistrationDefinitionProperties. -func (r RegistrationAssignmentPropertiesRegistrationDefinitionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authorizations", r.Authorizations) - populate(objectMap, "description", r.Description) - populate(objectMap, "eligibleAuthorizations", r.EligibleAuthorizations) - populate(objectMap, "managedByTenantId", r.ManagedByTenantID) - populate(objectMap, "managedByTenantName", r.ManagedByTenantName) - populate(objectMap, "manageeTenantId", r.ManageeTenantID) - populate(objectMap, "manageeTenantName", r.ManageeTenantName) - populate(objectMap, "provisioningState", r.ProvisioningState) - populate(objectMap, "registrationDefinitionName", r.RegistrationDefinitionName) - return json.Marshal(objectMap) -} - // RegistrationAssignmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the RegistrationAssignmentsClient.BeginCreateOrUpdate // method. type RegistrationAssignmentsClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // RegistrationAssignmentsClientBeginDeleteOptions contains the optional parameters for the RegistrationAssignmentsClient.BeginDelete // method. type RegistrationAssignmentsClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // RegistrationAssignmentsClientGetOptions contains the optional parameters for the RegistrationAssignmentsClient.Get method. @@ -405,6 +336,8 @@ type RegistrationAssignmentsClientGetOptions struct { type RegistrationAssignmentsClientListOptions struct { // The flag indicating whether to return the registration definition details along with the registration assignment details. ExpandRegistrationDefinition *bool + // The filter query parameter to filter managed services resources by. + Filter *string } // RegistrationDefinition - The registration definition. @@ -421,6 +354,9 @@ type RegistrationDefinition struct { // READ-ONLY; The name of the registration definition. Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; The metadata for the registration assignment resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the Azure resource (Microsoft.ManagedServices/registrationDefinitions). Type *string `json:"type,omitempty" azure:"ro"` } @@ -434,14 +370,6 @@ type RegistrationDefinitionList struct { Value []*RegistrationDefinition `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type RegistrationDefinitionList. -func (r RegistrationDefinitionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - // RegistrationDefinitionProperties - The properties of a registration definition. type RegistrationDefinitionProperties struct { // REQUIRED; The collection of authorization objects describing the access Azure Active Directory principals in the managedBy @@ -475,25 +403,11 @@ type RegistrationDefinitionProperties struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type RegistrationDefinitionProperties. -func (r RegistrationDefinitionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authorizations", r.Authorizations) - populate(objectMap, "description", r.Description) - populate(objectMap, "eligibleAuthorizations", r.EligibleAuthorizations) - populate(objectMap, "managedByTenantId", r.ManagedByTenantID) - populate(objectMap, "managedByTenantName", r.ManagedByTenantName) - populate(objectMap, "manageeTenantId", r.ManageeTenantID) - populate(objectMap, "manageeTenantName", r.ManageeTenantName) - populate(objectMap, "provisioningState", r.ProvisioningState) - populate(objectMap, "registrationDefinitionName", r.RegistrationDefinitionName) - return json.Marshal(objectMap) -} - // RegistrationDefinitionsClientBeginCreateOrUpdateOptions contains the optional parameters for the RegistrationDefinitionsClient.BeginCreateOrUpdate // method. type RegistrationDefinitionsClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // RegistrationDefinitionsClientDeleteOptions contains the optional parameters for the RegistrationDefinitionsClient.Delete @@ -509,15 +423,27 @@ type RegistrationDefinitionsClientGetOptions struct { // RegistrationDefinitionsClientListOptions contains the optional parameters for the RegistrationDefinitionsClient.List method. type RegistrationDefinitionsClientListOptions struct { - // placeholder for future optional parameters + // The filter query parameter to filter managed services resources by. + Filter *string } -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } +// 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"` } diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_models_serde.go b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_models_serde.go new file mode 100644 index 000000000000..0a3683604b5d --- /dev/null +++ b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_models_serde.go @@ -0,0 +1,180 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmanagedservices + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Authorization. +func (a Authorization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "delegatedRoleDefinitionIds", a.DelegatedRoleDefinitionIDs) + populate(objectMap, "principalId", a.PrincipalID) + populate(objectMap, "principalIdDisplayName", a.PrincipalIDDisplayName) + populate(objectMap, "roleDefinitionId", a.RoleDefinitionID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. +func (e ErrorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type JustInTimeAccessPolicy. +func (j JustInTimeAccessPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "managedByTenantApprovers", j.ManagedByTenantApprovers) + populate(objectMap, "maximumActivationDuration", j.MaximumActivationDuration) + populate(objectMap, "multiFactorAuthProvider", j.MultiFactorAuthProvider) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MarketplaceRegistrationDefinitionList. +func (m MarketplaceRegistrationDefinitionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MarketplaceRegistrationDefinitionProperties. +func (m MarketplaceRegistrationDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authorizations", m.Authorizations) + populate(objectMap, "eligibleAuthorizations", m.EligibleAuthorizations) + populate(objectMap, "managedByTenantId", m.ManagedByTenantID) + populate(objectMap, "offerDisplayName", m.OfferDisplayName) + populate(objectMap, "planDisplayName", m.PlanDisplayName) + populate(objectMap, "publisherDisplayName", m.PublisherDisplayName) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OperationList. +func (o OperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RegistrationAssignmentList. +func (r RegistrationAssignmentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RegistrationAssignmentPropertiesRegistrationDefinitionProperties. +func (r RegistrationAssignmentPropertiesRegistrationDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authorizations", r.Authorizations) + populate(objectMap, "description", r.Description) + populate(objectMap, "eligibleAuthorizations", r.EligibleAuthorizations) + populate(objectMap, "managedByTenantId", r.ManagedByTenantID) + populate(objectMap, "managedByTenantName", r.ManagedByTenantName) + populate(objectMap, "manageeTenantId", r.ManageeTenantID) + populate(objectMap, "manageeTenantName", r.ManageeTenantName) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "registrationDefinitionName", r.RegistrationDefinitionName) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RegistrationDefinitionList. +func (r RegistrationDefinitionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RegistrationDefinitionProperties. +func (r RegistrationDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authorizations", r.Authorizations) + populate(objectMap, "description", r.Description) + populate(objectMap, "eligibleAuthorizations", r.EligibleAuthorizations) + populate(objectMap, "managedByTenantId", r.ManagedByTenantID) + populate(objectMap, "managedByTenantName", r.ManagedByTenantName) + populate(objectMap, "manageeTenantId", r.ManageeTenantID) + populate(objectMap, "manageeTenantName", r.ManageeTenantName) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "registrationDefinitionName", r.RegistrationDefinitionName) + return json.Marshal(objectMap) +} + +// 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 +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_operations_client.go b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_operations_client.go index 80a910563790..91f068247857 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_operations_client.go +++ b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,19 +29,23 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Gets a list of the operations. @@ -69,7 +74,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-02-01-preview") + reqQP.Set("api-version", "2022-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -77,7 +82,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationList); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_operationswithscope_client.go b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_operationswithscope_client.go new file mode 100644 index 000000000000..1de954a0dd2e --- /dev/null +++ b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_operationswithscope_client.go @@ -0,0 +1,94 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmanagedservices + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// OperationsWithScopeClient contains the methods for the OperationsWithScope group. +// Don't use this type directly, use NewOperationsWithScopeClient() instead. +type OperationsWithScopeClient struct { + host string + pl runtime.Pipeline +} + +// NewOperationsWithScopeClient creates a new instance of OperationsWithScopeClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewOperationsWithScopeClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsWithScopeClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &OperationsWithScopeClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// List - Gets a list of the operations with the scope. +// If the operation fails it returns an *azcore.ResponseError type. +// scope - The scope of the resource. +// options - OperationsWithScopeClientListOptions contains the optional parameters for the OperationsWithScopeClient.List +// method. +func (client *OperationsWithScopeClient) List(ctx context.Context, scope string, options *OperationsWithScopeClientListOptions) (OperationsWithScopeClientListResponse, error) { + req, err := client.listCreateRequest(ctx, scope, options) + if err != nil { + return OperationsWithScopeClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsWithScopeClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsWithScopeClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *OperationsWithScopeClient) listCreateRequest(ctx context.Context, scope string, options *OperationsWithScopeClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.ManagedServices/operations" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-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 *OperationsWithScopeClient) listHandleResponse(resp *http.Response) (OperationsWithScopeClientListResponse, error) { + result := OperationsWithScopeClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationList); err != nil { + return OperationsWithScopeClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_pagers.go b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_pagers.go deleted file mode 100644 index ac792da2b6c6..000000000000 --- a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_pagers.go +++ /dev/null @@ -1,233 +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 armmanagedservices - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// MarketplaceRegistrationDefinitionsClientListPager provides operations for iterating over paged responses. -type MarketplaceRegistrationDefinitionsClientListPager struct { - client *MarketplaceRegistrationDefinitionsClient - current MarketplaceRegistrationDefinitionsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, MarketplaceRegistrationDefinitionsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *MarketplaceRegistrationDefinitionsClientListPager) 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 *MarketplaceRegistrationDefinitionsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.MarketplaceRegistrationDefinitionList.NextLink == nil || len(*p.current.MarketplaceRegistrationDefinitionList.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 = runtime.NewResponseError(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 MarketplaceRegistrationDefinitionsClientListResponse page. -func (p *MarketplaceRegistrationDefinitionsClientListPager) PageResponse() MarketplaceRegistrationDefinitionsClientListResponse { - return p.current -} - -// MarketplaceRegistrationDefinitionsWithoutScopeClientListPager provides operations for iterating over paged responses. -type MarketplaceRegistrationDefinitionsWithoutScopeClientListPager struct { - client *MarketplaceRegistrationDefinitionsWithoutScopeClient - current MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *MarketplaceRegistrationDefinitionsWithoutScopeClientListPager) 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 *MarketplaceRegistrationDefinitionsWithoutScopeClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.MarketplaceRegistrationDefinitionList.NextLink == nil || len(*p.current.MarketplaceRegistrationDefinitionList.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 = runtime.NewResponseError(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 MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse page. -func (p *MarketplaceRegistrationDefinitionsWithoutScopeClientListPager) PageResponse() MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse { - return p.current -} - -// RegistrationAssignmentsClientListPager provides operations for iterating over paged responses. -type RegistrationAssignmentsClientListPager struct { - client *RegistrationAssignmentsClient - current RegistrationAssignmentsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, RegistrationAssignmentsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *RegistrationAssignmentsClientListPager) 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 *RegistrationAssignmentsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.RegistrationAssignmentList.NextLink == nil || len(*p.current.RegistrationAssignmentList.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 = runtime.NewResponseError(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 RegistrationAssignmentsClientListResponse page. -func (p *RegistrationAssignmentsClientListPager) PageResponse() RegistrationAssignmentsClientListResponse { - return p.current -} - -// RegistrationDefinitionsClientListPager provides operations for iterating over paged responses. -type RegistrationDefinitionsClientListPager struct { - client *RegistrationDefinitionsClient - current RegistrationDefinitionsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, RegistrationDefinitionsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *RegistrationDefinitionsClientListPager) 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 *RegistrationDefinitionsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.RegistrationDefinitionList.NextLink == nil || len(*p.current.RegistrationDefinitionList.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 = runtime.NewResponseError(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 RegistrationDefinitionsClientListResponse page. -func (p *RegistrationDefinitionsClientListPager) PageResponse() RegistrationDefinitionsClientListResponse { - return p.current -} diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_pollers.go b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_pollers.go deleted file mode 100644 index 749138144df9..000000000000 --- a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_pollers.go +++ /dev/null @@ -1,144 +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 armmanagedservices - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// RegistrationAssignmentsClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type RegistrationAssignmentsClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *RegistrationAssignmentsClientCreateOrUpdatePoller) 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 *RegistrationAssignmentsClientCreateOrUpdatePoller) 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 RegistrationAssignmentsClientCreateOrUpdateResponse will be returned. -func (p *RegistrationAssignmentsClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (RegistrationAssignmentsClientCreateOrUpdateResponse, error) { - respType := RegistrationAssignmentsClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.RegistrationAssignment) - if err != nil { - return RegistrationAssignmentsClientCreateOrUpdateResponse{}, 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 *RegistrationAssignmentsClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// RegistrationAssignmentsClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type RegistrationAssignmentsClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *RegistrationAssignmentsClientDeletePoller) 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 *RegistrationAssignmentsClientDeletePoller) 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 RegistrationAssignmentsClientDeleteResponse will be returned. -func (p *RegistrationAssignmentsClientDeletePoller) FinalResponse(ctx context.Context) (RegistrationAssignmentsClientDeleteResponse, error) { - respType := RegistrationAssignmentsClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return RegistrationAssignmentsClientDeleteResponse{}, 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 *RegistrationAssignmentsClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// RegistrationDefinitionsClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type RegistrationDefinitionsClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *RegistrationDefinitionsClientCreateOrUpdatePoller) 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 *RegistrationDefinitionsClientCreateOrUpdatePoller) 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 RegistrationDefinitionsClientCreateOrUpdateResponse will be returned. -func (p *RegistrationDefinitionsClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (RegistrationDefinitionsClientCreateOrUpdateResponse, error) { - respType := RegistrationDefinitionsClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.RegistrationDefinition) - if err != nil { - return RegistrationDefinitionsClientCreateOrUpdateResponse{}, 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 *RegistrationDefinitionsClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_registrationassignments_client.go b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_registrationassignments_client.go index 50416768b52d..d32aed4d06de 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_registrationassignments_client.go +++ b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_registrationassignments_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -32,19 +33,23 @@ type RegistrationAssignmentsClient struct { // NewRegistrationAssignmentsClient creates a new instance of RegistrationAssignmentsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewRegistrationAssignmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *RegistrationAssignmentsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewRegistrationAssignmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RegistrationAssignmentsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &RegistrationAssignmentsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Creates or updates a registration assignment. @@ -54,22 +59,16 @@ func NewRegistrationAssignmentsClient(credential azcore.TokenCredential, options // requestBody - The parameters required to create new registration assignment. // options - RegistrationAssignmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the RegistrationAssignmentsClient.BeginCreateOrUpdate // method. -func (client *RegistrationAssignmentsClient) BeginCreateOrUpdate(ctx context.Context, scope string, registrationAssignmentID string, requestBody RegistrationAssignment, options *RegistrationAssignmentsClientBeginCreateOrUpdateOptions) (RegistrationAssignmentsClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, scope, registrationAssignmentID, requestBody, options) - if err != nil { - return RegistrationAssignmentsClientCreateOrUpdatePollerResponse{}, err - } - result := RegistrationAssignmentsClientCreateOrUpdatePollerResponse{ - RawResponse: resp, +func (client *RegistrationAssignmentsClient) BeginCreateOrUpdate(ctx context.Context, scope string, registrationAssignmentID string, requestBody RegistrationAssignment, options *RegistrationAssignmentsClientBeginCreateOrUpdateOptions) (*armruntime.Poller[RegistrationAssignmentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, scope, registrationAssignmentID, requestBody, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[RegistrationAssignmentsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[RegistrationAssignmentsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("RegistrationAssignmentsClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return RegistrationAssignmentsClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &RegistrationAssignmentsClientCreateOrUpdatePoller{ - pt: pt, - } - return result, nil } // CreateOrUpdate - Creates or updates a registration assignment. @@ -102,7 +101,7 @@ func (client *RegistrationAssignmentsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-02-01-preview") + reqQP.Set("api-version", "2022-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, requestBody) @@ -114,22 +113,16 @@ func (client *RegistrationAssignmentsClient) createOrUpdateCreateRequest(ctx con // registrationAssignmentID - The GUID of the registration assignment. // options - RegistrationAssignmentsClientBeginDeleteOptions contains the optional parameters for the RegistrationAssignmentsClient.BeginDelete // method. -func (client *RegistrationAssignmentsClient) BeginDelete(ctx context.Context, scope string, registrationAssignmentID string, options *RegistrationAssignmentsClientBeginDeleteOptions) (RegistrationAssignmentsClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, scope, registrationAssignmentID, options) - if err != nil { - return RegistrationAssignmentsClientDeletePollerResponse{}, err - } - result := RegistrationAssignmentsClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("RegistrationAssignmentsClient.Delete", "", resp, client.pl) - if err != nil { - return RegistrationAssignmentsClientDeletePollerResponse{}, err +func (client *RegistrationAssignmentsClient) BeginDelete(ctx context.Context, scope string, registrationAssignmentID string, options *RegistrationAssignmentsClientBeginDeleteOptions) (*armruntime.Poller[RegistrationAssignmentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, scope, registrationAssignmentID, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[RegistrationAssignmentsClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[RegistrationAssignmentsClientDeleteResponse](options.ResumeToken, client.pl, nil) } - result.Poller = &RegistrationAssignmentsClientDeletePoller{ - pt: pt, - } - return result, nil } // Delete - Deletes the specified registration assignment. @@ -162,7 +155,7 @@ func (client *RegistrationAssignmentsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-02-01-preview") + reqQP.Set("api-version", "2022-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -205,7 +198,7 @@ func (client *RegistrationAssignmentsClient) getCreateRequest(ctx context.Contex if options != nil && options.ExpandRegistrationDefinition != nil { reqQP.Set("$expandRegistrationDefinition", strconv.FormatBool(*options.ExpandRegistrationDefinition)) } - reqQP.Set("api-version", "2020-02-01-preview") + reqQP.Set("api-version", "2022-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -213,7 +206,7 @@ func (client *RegistrationAssignmentsClient) getCreateRequest(ctx context.Contex // getHandleResponse handles the Get response. func (client *RegistrationAssignmentsClient) getHandleResponse(resp *http.Response) (RegistrationAssignmentsClientGetResponse, error) { - result := RegistrationAssignmentsClientGetResponse{RawResponse: resp} + result := RegistrationAssignmentsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RegistrationAssignment); err != nil { return RegistrationAssignmentsClientGetResponse{}, err } @@ -225,16 +218,32 @@ func (client *RegistrationAssignmentsClient) getHandleResponse(resp *http.Respon // scope - The scope of the resource. // options - RegistrationAssignmentsClientListOptions contains the optional parameters for the RegistrationAssignmentsClient.List // method. -func (client *RegistrationAssignmentsClient) List(scope string, options *RegistrationAssignmentsClientListOptions) *RegistrationAssignmentsClientListPager { - return &RegistrationAssignmentsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, scope, options) +func (client *RegistrationAssignmentsClient) List(scope string, options *RegistrationAssignmentsClientListOptions) *runtime.Pager[RegistrationAssignmentsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[RegistrationAssignmentsClientListResponse]{ + More: func(page RegistrationAssignmentsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp RegistrationAssignmentsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.RegistrationAssignmentList.NextLink) + Fetcher: func(ctx context.Context, page *RegistrationAssignmentsClientListResponse) (RegistrationAssignmentsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RegistrationAssignmentsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RegistrationAssignmentsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RegistrationAssignmentsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -249,7 +258,10 @@ func (client *RegistrationAssignmentsClient) listCreateRequest(ctx context.Conte if options != nil && options.ExpandRegistrationDefinition != nil { reqQP.Set("$expandRegistrationDefinition", strconv.FormatBool(*options.ExpandRegistrationDefinition)) } - reqQP.Set("api-version", "2020-02-01-preview") + reqQP.Set("api-version", "2022-01-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -257,7 +269,7 @@ func (client *RegistrationAssignmentsClient) listCreateRequest(ctx context.Conte // listHandleResponse handles the List response. func (client *RegistrationAssignmentsClient) listHandleResponse(resp *http.Response) (RegistrationAssignmentsClientListResponse, error) { - result := RegistrationAssignmentsClientListResponse{RawResponse: resp} + result := RegistrationAssignmentsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RegistrationAssignmentList); err != nil { return RegistrationAssignmentsClientListResponse{}, err } diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_registrationdefinitions_client.go b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_registrationdefinitions_client.go index 9a642401ccc0..e82f9219c3ff 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_registrationdefinitions_client.go +++ b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_registrationdefinitions_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -31,19 +32,23 @@ type RegistrationDefinitionsClient struct { // NewRegistrationDefinitionsClient creates a new instance of RegistrationDefinitionsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewRegistrationDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *RegistrationDefinitionsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewRegistrationDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RegistrationDefinitionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &RegistrationDefinitionsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Creates or updates a registration definition. @@ -53,22 +58,16 @@ func NewRegistrationDefinitionsClient(credential azcore.TokenCredential, options // requestBody - The parameters required to create a new registration definition. // options - RegistrationDefinitionsClientBeginCreateOrUpdateOptions contains the optional parameters for the RegistrationDefinitionsClient.BeginCreateOrUpdate // method. -func (client *RegistrationDefinitionsClient) BeginCreateOrUpdate(ctx context.Context, registrationDefinitionID string, scope string, requestBody RegistrationDefinition, options *RegistrationDefinitionsClientBeginCreateOrUpdateOptions) (RegistrationDefinitionsClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, registrationDefinitionID, scope, requestBody, options) - if err != nil { - return RegistrationDefinitionsClientCreateOrUpdatePollerResponse{}, err - } - result := RegistrationDefinitionsClientCreateOrUpdatePollerResponse{ - RawResponse: resp, +func (client *RegistrationDefinitionsClient) BeginCreateOrUpdate(ctx context.Context, registrationDefinitionID string, scope string, requestBody RegistrationDefinition, options *RegistrationDefinitionsClientBeginCreateOrUpdateOptions) (*armruntime.Poller[RegistrationDefinitionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, registrationDefinitionID, scope, requestBody, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[RegistrationDefinitionsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[RegistrationDefinitionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("RegistrationDefinitionsClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return RegistrationDefinitionsClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &RegistrationDefinitionsClientCreateOrUpdatePoller{ - pt: pt, - } - return result, nil } // CreateOrUpdate - Creates or updates a registration definition. @@ -101,7 +100,7 @@ func (client *RegistrationDefinitionsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-02-01-preview") + reqQP.Set("api-version", "2022-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, requestBody) @@ -125,7 +124,7 @@ func (client *RegistrationDefinitionsClient) Delete(ctx context.Context, registr if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return RegistrationDefinitionsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return RegistrationDefinitionsClientDeleteResponse{RawResponse: resp}, nil + return RegistrationDefinitionsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -141,7 +140,7 @@ func (client *RegistrationDefinitionsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-02-01-preview") + reqQP.Set("api-version", "2022-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -181,7 +180,7 @@ func (client *RegistrationDefinitionsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-02-01-preview") + reqQP.Set("api-version", "2022-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -189,7 +188,7 @@ func (client *RegistrationDefinitionsClient) getCreateRequest(ctx context.Contex // getHandleResponse handles the Get response. func (client *RegistrationDefinitionsClient) getHandleResponse(resp *http.Response) (RegistrationDefinitionsClientGetResponse, error) { - result := RegistrationDefinitionsClientGetResponse{RawResponse: resp} + result := RegistrationDefinitionsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RegistrationDefinition); err != nil { return RegistrationDefinitionsClientGetResponse{}, err } @@ -201,16 +200,32 @@ func (client *RegistrationDefinitionsClient) getHandleResponse(resp *http.Respon // scope - The scope of the resource. // options - RegistrationDefinitionsClientListOptions contains the optional parameters for the RegistrationDefinitionsClient.List // method. -func (client *RegistrationDefinitionsClient) List(scope string, options *RegistrationDefinitionsClientListOptions) *RegistrationDefinitionsClientListPager { - return &RegistrationDefinitionsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, scope, options) +func (client *RegistrationDefinitionsClient) List(scope string, options *RegistrationDefinitionsClientListOptions) *runtime.Pager[RegistrationDefinitionsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[RegistrationDefinitionsClientListResponse]{ + More: func(page RegistrationDefinitionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp RegistrationDefinitionsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.RegistrationDefinitionList.NextLink) + Fetcher: func(ctx context.Context, page *RegistrationDefinitionsClientListResponse) (RegistrationDefinitionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RegistrationDefinitionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RegistrationDefinitionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RegistrationDefinitionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -222,7 +237,10 @@ func (client *RegistrationDefinitionsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-02-01-preview") + reqQP.Set("api-version", "2022-01-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -230,7 +248,7 @@ func (client *RegistrationDefinitionsClient) listCreateRequest(ctx context.Conte // listHandleResponse handles the List response. func (client *RegistrationDefinitionsClient) listHandleResponse(resp *http.Response) (RegistrationDefinitionsClientListResponse, error) { - result := RegistrationDefinitionsClientListResponse{RawResponse: resp} + result := RegistrationDefinitionsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RegistrationDefinitionList); err != nil { return RegistrationDefinitionsClientListResponse{}, err } diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_response_types.go b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_response_types.go index 4c2af713edbe..42463343bca3 100644 --- a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_response_types.go +++ b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,273 +8,72 @@ package armmanagedservices -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - // MarketplaceRegistrationDefinitionsClientGetResponse contains the response from method MarketplaceRegistrationDefinitionsClient.Get. type MarketplaceRegistrationDefinitionsClientGetResponse struct { - MarketplaceRegistrationDefinitionsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MarketplaceRegistrationDefinitionsClientGetResult contains the result from method MarketplaceRegistrationDefinitionsClient.Get. -type MarketplaceRegistrationDefinitionsClientGetResult struct { MarketplaceRegistrationDefinition } // MarketplaceRegistrationDefinitionsClientListResponse contains the response from method MarketplaceRegistrationDefinitionsClient.List. type MarketplaceRegistrationDefinitionsClientListResponse struct { - MarketplaceRegistrationDefinitionsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MarketplaceRegistrationDefinitionsClientListResult contains the result from method MarketplaceRegistrationDefinitionsClient.List. -type MarketplaceRegistrationDefinitionsClientListResult struct { MarketplaceRegistrationDefinitionList } // MarketplaceRegistrationDefinitionsWithoutScopeClientGetResponse contains the response from method MarketplaceRegistrationDefinitionsWithoutScopeClient.Get. type MarketplaceRegistrationDefinitionsWithoutScopeClientGetResponse struct { - MarketplaceRegistrationDefinitionsWithoutScopeClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MarketplaceRegistrationDefinitionsWithoutScopeClientGetResult contains the result from method MarketplaceRegistrationDefinitionsWithoutScopeClient.Get. -type MarketplaceRegistrationDefinitionsWithoutScopeClientGetResult struct { MarketplaceRegistrationDefinition } // MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse contains the response from method MarketplaceRegistrationDefinitionsWithoutScopeClient.List. type MarketplaceRegistrationDefinitionsWithoutScopeClientListResponse struct { - MarketplaceRegistrationDefinitionsWithoutScopeClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MarketplaceRegistrationDefinitionsWithoutScopeClientListResult contains the result from method MarketplaceRegistrationDefinitionsWithoutScopeClient.List. -type MarketplaceRegistrationDefinitionsWithoutScopeClientListResult struct { MarketplaceRegistrationDefinitionList } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationList } -// RegistrationAssignmentsClientCreateOrUpdatePollerResponse contains the response from method RegistrationAssignmentsClient.CreateOrUpdate. -type RegistrationAssignmentsClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *RegistrationAssignmentsClientCreateOrUpdatePoller - - // 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 RegistrationAssignmentsClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RegistrationAssignmentsClientCreateOrUpdateResponse, error) { - respType := RegistrationAssignmentsClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RegistrationAssignment) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a RegistrationAssignmentsClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *RegistrationAssignmentsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *RegistrationAssignmentsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("RegistrationAssignmentsClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &RegistrationAssignmentsClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil +// OperationsWithScopeClientListResponse contains the response from method OperationsWithScopeClient.List. +type OperationsWithScopeClientListResponse struct { + OperationList } // RegistrationAssignmentsClientCreateOrUpdateResponse contains the response from method RegistrationAssignmentsClient.CreateOrUpdate. type RegistrationAssignmentsClientCreateOrUpdateResponse struct { - RegistrationAssignmentsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// RegistrationAssignmentsClientCreateOrUpdateResult contains the result from method RegistrationAssignmentsClient.CreateOrUpdate. -type RegistrationAssignmentsClientCreateOrUpdateResult struct { RegistrationAssignment } -// RegistrationAssignmentsClientDeletePollerResponse contains the response from method RegistrationAssignmentsClient.Delete. -type RegistrationAssignmentsClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *RegistrationAssignmentsClientDeletePoller - - // 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 RegistrationAssignmentsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RegistrationAssignmentsClientDeleteResponse, error) { - respType := RegistrationAssignmentsClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a RegistrationAssignmentsClientDeletePollerResponse from the provided client and resume token. -func (l *RegistrationAssignmentsClientDeletePollerResponse) Resume(ctx context.Context, client *RegistrationAssignmentsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("RegistrationAssignmentsClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &RegistrationAssignmentsClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // RegistrationAssignmentsClientDeleteResponse contains the response from method RegistrationAssignmentsClient.Delete. type RegistrationAssignmentsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // RegistrationAssignmentsClientGetResponse contains the response from method RegistrationAssignmentsClient.Get. type RegistrationAssignmentsClientGetResponse struct { - RegistrationAssignmentsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// RegistrationAssignmentsClientGetResult contains the result from method RegistrationAssignmentsClient.Get. -type RegistrationAssignmentsClientGetResult struct { RegistrationAssignment } // RegistrationAssignmentsClientListResponse contains the response from method RegistrationAssignmentsClient.List. type RegistrationAssignmentsClientListResponse struct { - RegistrationAssignmentsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// RegistrationAssignmentsClientListResult contains the result from method RegistrationAssignmentsClient.List. -type RegistrationAssignmentsClientListResult struct { RegistrationAssignmentList } -// RegistrationDefinitionsClientCreateOrUpdatePollerResponse contains the response from method RegistrationDefinitionsClient.CreateOrUpdate. -type RegistrationDefinitionsClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *RegistrationDefinitionsClientCreateOrUpdatePoller - - // 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 RegistrationDefinitionsClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RegistrationDefinitionsClientCreateOrUpdateResponse, error) { - respType := RegistrationDefinitionsClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RegistrationDefinition) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a RegistrationDefinitionsClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *RegistrationDefinitionsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *RegistrationDefinitionsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("RegistrationDefinitionsClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &RegistrationDefinitionsClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // RegistrationDefinitionsClientCreateOrUpdateResponse contains the response from method RegistrationDefinitionsClient.CreateOrUpdate. type RegistrationDefinitionsClientCreateOrUpdateResponse struct { - RegistrationDefinitionsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// RegistrationDefinitionsClientCreateOrUpdateResult contains the result from method RegistrationDefinitionsClient.CreateOrUpdate. -type RegistrationDefinitionsClientCreateOrUpdateResult struct { RegistrationDefinition } // RegistrationDefinitionsClientDeleteResponse contains the response from method RegistrationDefinitionsClient.Delete. type RegistrationDefinitionsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // RegistrationDefinitionsClientGetResponse contains the response from method RegistrationDefinitionsClient.Get. type RegistrationDefinitionsClientGetResponse struct { - RegistrationDefinitionsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// RegistrationDefinitionsClientGetResult contains the result from method RegistrationDefinitionsClient.Get. -type RegistrationDefinitionsClientGetResult struct { RegistrationDefinition } // RegistrationDefinitionsClientListResponse contains the response from method RegistrationDefinitionsClient.List. type RegistrationDefinitionsClientListResponse struct { - RegistrationDefinitionsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// RegistrationDefinitionsClientListResult contains the result from method RegistrationDefinitionsClient.List. -type RegistrationDefinitionsClientListResult struct { RegistrationDefinitionList } diff --git a/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_time_rfc3339.go b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..90135bf45413 --- /dev/null +++ b/sdk/resourcemanager/managedservices/armmanagedservices/zz_generated_time_rfc3339.go @@ -0,0 +1,85 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmanagedservices + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *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/managementgroups/armmanagementgroups/CHANGELOG.md b/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md index 6a183c83a0d0..a02ee1833f0e 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md @@ -1,5 +1,151 @@ # Release History +## 0.5.0 (2022-04-12) +### Breaking Changes + +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `*OperationsClient.List` return value(s) have been changed from `(*OperationsClientListPager)` to `(*runtime.Pager[OperationsClientListResponse])` +- Function `*EntitiesClient.List` return value(s) have been changed from `(*EntitiesClientListPager)` to `(*runtime.Pager[EntitiesClientListResponse])` +- Function `*ManagementGroupSubscriptionsClient.GetSubscriptionsUnderManagementGroup` return value(s) have been changed from `(*ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupPager)` to `(*runtime.Pager[ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse])` +- Function `NewAPIClient` return value(s) have been changed from `(*APIClient)` to `(*APIClient, error)` +- Function `NewClient` return value(s) have been changed from `(*Client)` to `(*Client, error)` +- Function `*Client.BeginCreateOrUpdate` return value(s) have been changed from `(ClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[ClientCreateOrUpdateResponse], error)` +- Function `NewManagementGroupSubscriptionsClient` return value(s) have been changed from `(*ManagementGroupSubscriptionsClient)` to `(*ManagementGroupSubscriptionsClient, error)` +- Function `NewEntitiesClient` return value(s) have been changed from `(*EntitiesClient)` to `(*EntitiesClient, error)` +- Function `*Client.BeginDelete` return value(s) have been changed from `(ClientDeletePollerResponse, error)` to `(*armruntime.Poller[ClientDeleteResponse], error)` +- Function `*Client.GetDescendants` return value(s) have been changed from `(*ClientGetDescendantsPager)` to `(*runtime.Pager[ClientGetDescendantsResponse])` +- Function `NewHierarchySettingsClient` return value(s) have been changed from `(*HierarchySettingsClient)` to `(*HierarchySettingsClient, error)` +- Function `*Client.List` return value(s) have been changed from `(*ClientListPager)` to `(*runtime.Pager[ClientListResponse])` +- Function `Permissions.ToPtr` has been removed +- Function `*ClientGetDescendantsPager.PageResponse` has been removed +- Function `*EntitiesClientListPager.PageResponse` has been removed +- Function `Status.ToPtr` has been removed +- Function `*ClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*OperationsClientListPager.Err` has been removed +- Function `*EntitiesClientListPager.Err` has been removed +- Function `*ClientListPager.Err` has been removed +- Function `Reason.ToPtr` has been removed +- Function `*ClientListPager.PageResponse` has been removed +- Function `*ClientCreateOrUpdatePoller.Done` has been removed +- Function `*ClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `EntityViewParameterType.ToPtr` has been removed +- Function `ClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*ClientDeletePoller.Poll` has been removed +- Function `*ClientDeletePollerResponse.Resume` has been removed +- Function `EntitySearchType.ToPtr` has been removed +- Function `*ClientCreateOrUpdatePoller.Poll` has been removed +- Function `*ClientListPager.NextPage` has been removed +- Function `*ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupPager.PageResponse` has been removed +- Function `*ClientGetDescendantsPager.NextPage` has been removed +- Function `ManagementGroupChildType.ToPtr` has been removed +- Function `*ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupPager.Err` has been removed +- Function `*OperationsClientListPager.PageResponse` has been removed +- Function `*ClientDeletePoller.ResumeToken` has been removed +- Function `*EntitiesClientListPager.NextPage` has been removed +- Function `*ClientGetDescendantsPager.Err` has been removed +- Function `ClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*ClientDeletePoller.Done` has been removed +- Function `*ClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `ManagementGroupExpandType.ToPtr` has been removed +- Function `*ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupPager.NextPage` has been removed +- Function `*ClientDeletePoller.FinalResponse` has been removed +- Function `*OperationsClientListPager.NextPage` has been removed +- Struct `APIClientCheckNameAvailabilityResult` has been removed +- Struct `APIClientStartTenantBackfillResult` has been removed +- Struct `APIClientTenantBackfillStatusResult` has been removed +- Struct `ClientCreateOrUpdatePoller` has been removed +- Struct `ClientCreateOrUpdatePollerResponse` has been removed +- Struct `ClientCreateOrUpdateResult` has been removed +- Struct `ClientDeletePoller` has been removed +- Struct `ClientDeletePollerResponse` has been removed +- Struct `ClientDeleteResult` has been removed +- Struct `ClientGetDescendantsPager` has been removed +- Struct `ClientGetDescendantsResult` has been removed +- Struct `ClientGetResult` has been removed +- Struct `ClientListPager` has been removed +- Struct `ClientListResult` has been removed +- Struct `ClientUpdateResult` has been removed +- Struct `EntitiesClientListPager` has been removed +- Struct `EntitiesClientListResult` has been removed +- Struct `HierarchySettingsClientCreateOrUpdateResult` has been removed +- Struct `HierarchySettingsClientGetResult` has been removed +- Struct `HierarchySettingsClientListResult` has been removed +- Struct `HierarchySettingsClientUpdateResult` has been removed +- Struct `ManagementGroupSubscriptionsClientCreateResult` has been removed +- Struct `ManagementGroupSubscriptionsClientGetSubscriptionResult` has been removed +- Struct `ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupPager` has been removed +- Struct `ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResult` has been removed +- Struct `OperationsClientListPager` has been removed +- Struct `OperationsClientListResult` has been removed +- Field `HierarchySettingsClientListResult` of struct `HierarchySettingsClientListResponse` has been removed +- Field `RawResponse` of struct `HierarchySettingsClientListResponse` has been removed +- Field `ManagementGroupSubscriptionsClientCreateResult` of struct `ManagementGroupSubscriptionsClientCreateResponse` has been removed +- Field `RawResponse` of struct `ManagementGroupSubscriptionsClientCreateResponse` has been removed +- Field `EntitiesClientListResult` of struct `EntitiesClientListResponse` has been removed +- Field `RawResponse` of struct `EntitiesClientListResponse` has been removed +- Field `HierarchySettingsClientGetResult` of struct `HierarchySettingsClientGetResponse` has been removed +- Field `RawResponse` of struct `HierarchySettingsClientGetResponse` has been removed +- Field `ClientDeleteResult` of struct `ClientDeleteResponse` has been removed +- Field `RawResponse` of struct `ClientDeleteResponse` has been removed +- Field `HierarchySettingsClientCreateOrUpdateResult` of struct `HierarchySettingsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `HierarchySettingsClientCreateOrUpdateResponse` has been removed +- Field `ClientListResult` of struct `ClientListResponse` has been removed +- Field `RawResponse` of struct `ClientListResponse` has been removed +- Field `ClientGetResult` of struct `ClientGetResponse` has been removed +- Field `RawResponse` of struct `ClientGetResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `APIClientStartTenantBackfillResult` of struct `APIClientStartTenantBackfillResponse` has been removed +- Field `RawResponse` of struct `APIClientStartTenantBackfillResponse` has been removed +- Field `RawResponse` of struct `ManagementGroupSubscriptionsClientDeleteResponse` has been removed +- Field `ClientGetDescendantsResult` of struct `ClientGetDescendantsResponse` has been removed +- Field `RawResponse` of struct `ClientGetDescendantsResponse` has been removed +- Field `ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResult` of struct `ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse` has been removed +- Field `RawResponse` of struct `ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse` has been removed +- Field `HierarchySettingsClientUpdateResult` of struct `HierarchySettingsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `HierarchySettingsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `HierarchySettingsClientDeleteResponse` has been removed +- Field `ClientCreateOrUpdateResult` of struct `ClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ClientCreateOrUpdateResponse` has been removed +- Field `ManagementGroupSubscriptionsClientGetSubscriptionResult` of struct `ManagementGroupSubscriptionsClientGetSubscriptionResponse` has been removed +- Field `RawResponse` of struct `ManagementGroupSubscriptionsClientGetSubscriptionResponse` has been removed +- Field `APIClientCheckNameAvailabilityResult` of struct `APIClientCheckNameAvailabilityResponse` has been removed +- Field `RawResponse` of struct `APIClientCheckNameAvailabilityResponse` has been removed +- Field `ClientUpdateResult` of struct `ClientUpdateResponse` has been removed +- Field `RawResponse` of struct `ClientUpdateResponse` has been removed +- Field `APIClientTenantBackfillStatusResult` of struct `APIClientTenantBackfillStatusResponse` has been removed +- Field `RawResponse` of struct `APIClientTenantBackfillStatusResponse` has been removed + +### Features Added + +- New function `EntityHierarchyItemProperties.MarshalJSON() ([]byte, error)` +- New struct `EntityHierarchyItem` +- New struct `EntityHierarchyItemProperties` +- New struct `ErrorDetails` +- New struct `ErrorResponse` +- New struct `OperationResults` +- New anonymous field `CheckNameAvailabilityResult` in struct `APIClientCheckNameAvailabilityResponse` +- New anonymous field `SubscriptionUnderManagementGroup` in struct `ManagementGroupSubscriptionsClientCreateResponse` +- New anonymous field `TenantBackfillStatusResult` in struct `APIClientStartTenantBackfillResponse` +- New field `ResumeToken` in struct `ClientBeginCreateOrUpdateOptions` +- New anonymous field `HierarchySettingsList` in struct `HierarchySettingsClientListResponse` +- New anonymous field `ManagementGroup` in struct `ClientUpdateResponse` +- New anonymous field `HierarchySettings` in struct `HierarchySettingsClientGetResponse` +- New anonymous field `DescendantListResult` in struct `ClientGetDescendantsResponse` +- New anonymous field `HierarchySettings` in struct `HierarchySettingsClientCreateOrUpdateResponse` +- New field `ResumeToken` in struct `ClientBeginDeleteOptions` +- New anonymous field `ManagementGroup` in struct `ClientCreateOrUpdateResponse` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New anonymous field `ListSubscriptionUnderManagementGroup` in struct `ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse` +- New anonymous field `ManagementGroup` in struct `ClientGetResponse` +- New anonymous field `AzureAsyncOperationResults` in struct `ClientDeleteResponse` +- New anonymous field `SubscriptionUnderManagementGroup` in struct `ManagementGroupSubscriptionsClientGetSubscriptionResponse` +- New anonymous field `HierarchySettings` in struct `HierarchySettingsClientUpdateResponse` +- New anonymous field `EntityListResult` in struct `EntitiesClientListResponse` +- New anonymous field `ManagementGroupListResult` in struct `ClientListResponse` +- New anonymous field `TenantBackfillStatusResult` in struct `APIClientTenantBackfillStatusResponse` + + ## 0.4.0 (2022-02-22) ### Breaking Changes diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/README.md b/sdk/resourcemanager/managementgroups/armmanagementgroups/README.md index 648badce0d73..027270d456f5 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/README.md +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/README.md @@ -11,7 +11,7 @@ The `armmanagementgroups` module provides operations for working with Azure Mana ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden 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 -client := armmanagementgroups.NewOperationsClient(, cred, nil) +client, err := armmanagementgroups.NewOperationsClient(, cred, nil) ``` 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 -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armmanagementgroups.NewOperationsClient(, cred, &options) +client, err := armmanagementgroups.NewOperationsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/autorest.md b/sdk/resourcemanager/managementgroups/armmanagementgroups/autorest.md index 963495e8d75c..0bfa7236cb40 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/efd3d669a86d2e123f57ac3a43e5af4bb9e3a29f/specification/managementgroups/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/efd3d669a86d2e123f57ac3a43e5af4bb9e3a29f/specification/managementgroups/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/managementgroups/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/managementgroups/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.4.0 +module-version: 0.5.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod index 1320ada8111c..317b775a2961 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.1 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum index 27c9bd79d559..56d1c32628ae 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum @@ -1,21 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.1 h1:RxemzI2cHD0A8WyMqHu/UnDjfpGES/cmjtPbQoktWqs= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.1/go.mod h1:+nVKciyKD2J9TyVcEQ82Bo9b+3F92PiQfHrIE/zqLqM= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -35,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm 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/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/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-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -59,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_entities_client_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_entities_client_test.go index 6629083c4b0f..13d9b7a285ad 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_entities_client_test.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_entities_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,14 +16,19 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups" ) -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetEntities.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetEntities.json func ExampleEntitiesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewEntitiesClient(cred, nil) + client, err := armmanagementgroups.NewEntitiesClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(&armmanagementgroups.EntitiesClientListOptions{Skiptoken: nil, Skip: nil, Top: nil, @@ -34,16 +39,15 @@ func ExampleEntitiesClient_List() { GroupName: nil, CacheControl: nil, }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_hierarchysettings_client_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_hierarchysettings_client_test.go index 1bd602c343e7..6b250bd2700c 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_hierarchysettings_client_test.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_hierarchysettings_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,98 +17,132 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups" ) -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListHierarchySettings.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListHierarchySettings.json func ExampleHierarchySettingsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewHierarchySettingsClient(cred, nil) + client, err := armmanagementgroups.NewHierarchySettingsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.HierarchySettingsClientListResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetHierarchySettings.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetHierarchySettings.json func ExampleHierarchySettingsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewHierarchySettingsClient(cred, nil) + client, err := armmanagementgroups.NewHierarchySettingsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.HierarchySettingsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PutHierarchySettings.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PutHierarchySettings.json func ExampleHierarchySettingsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewHierarchySettingsClient(cred, nil) + client, err := armmanagementgroups.NewHierarchySettingsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", armmanagementgroups.CreateOrUpdateSettingsRequest{ Properties: &armmanagementgroups.CreateOrUpdateSettingsProperties{ - DefaultManagementGroup: to.StringPtr(""), - RequireAuthorizationForGroupCreation: to.BoolPtr(true), + DefaultManagementGroup: to.Ptr(""), + RequireAuthorizationForGroupCreation: to.Ptr(true), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.HierarchySettingsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PatchHierarchySettings.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PatchHierarchySettings.json func ExampleHierarchySettingsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewHierarchySettingsClient(cred, nil) + client, err := armmanagementgroups.NewHierarchySettingsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", armmanagementgroups.CreateOrUpdateSettingsRequest{ Properties: &armmanagementgroups.CreateOrUpdateSettingsProperties{ - DefaultManagementGroup: to.StringPtr(""), - RequireAuthorizationForGroupCreation: to.BoolPtr(true), + DefaultManagementGroup: to.Ptr(""), + RequireAuthorizationForGroupCreation: to.Ptr(true), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.HierarchySettingsClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/DeleteHierarchySettings.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/DeleteHierarchySettings.json func ExampleHierarchySettingsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewHierarchySettingsClient(cred, nil) + client, err := armmanagementgroups.NewHierarchySettingsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroups_client_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroups_client_test.go index 65a065761d83..c3be4b87594d 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroups_client_test.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroups_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,146 +19,187 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups" ) -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListManagementGroups.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListManagementGroups.json func ExampleClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewClient(cred, nil) - pager := client.List(&armmanagementgroups.ClientListOptions{CacheControl: to.StringPtr(""), + client, err := armmanagementgroups.NewClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List(&armmanagementgroups.ClientListOptions{CacheControl: to.Ptr(""), Skiptoken: nil, }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroup.json func ExampleClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewClient(cred, nil) + client, err := armmanagementgroups.NewClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", &armmanagementgroups.ClientGetOptions{Expand: nil, Recurse: nil, Filter: nil, - CacheControl: to.StringPtr(""), + CacheControl: to.Ptr(""), }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PutManagementGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PutManagementGroup.json func ExampleClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewClient(cred, nil) + client, err := armmanagementgroups.NewClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "", armmanagementgroups.CreateManagementGroupRequest{ Properties: &armmanagementgroups.CreateManagementGroupProperties{ - DisplayName: to.StringPtr(""), + DisplayName: to.Ptr(""), Details: &armmanagementgroups.CreateManagementGroupDetails{ Parent: &armmanagementgroups.CreateParentGroupInfo{ - ID: to.StringPtr(""), + ID: to.Ptr(""), }, }, }, }, - &armmanagementgroups.ClientBeginCreateOrUpdateOptions{CacheControl: to.StringPtr("")}) + &armmanagementgroups.ClientBeginCreateOrUpdateOptions{CacheControl: to.Ptr(""), + ResumeToken: "", + }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.ClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PatchManagementGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PatchManagementGroup.json func ExampleClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewClient(cred, nil) + client, err := armmanagementgroups.NewClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", armmanagementgroups.PatchManagementGroupRequest{ - DisplayName: to.StringPtr(""), - ParentGroupID: to.StringPtr(""), + DisplayName: to.Ptr(""), + ParentGroupID: to.Ptr(""), }, - &armmanagementgroups.ClientUpdateOptions{CacheControl: to.StringPtr("")}) + &armmanagementgroups.ClientUpdateOptions{CacheControl: to.Ptr("")}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/DeleteManagementGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/DeleteManagementGroup.json func ExampleClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewClient(cred, nil) + client, err := armmanagementgroups.NewClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "", - &armmanagementgroups.ClientBeginDeleteOptions{CacheControl: to.StringPtr("")}) + &armmanagementgroups.ClientBeginDeleteOptions{CacheControl: to.Ptr(""), + ResumeToken: "", + }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetDescendants.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetDescendants.json func ExampleClient_GetDescendants() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewClient(cred, nil) + client, err := armmanagementgroups.NewClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.GetDescendants("", &armmanagementgroups.ClientGetDescendantsOptions{Skiptoken: nil, Top: nil, }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsapi_client_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsapi_client_test.go index 4b1743f7b918..5d87b844883a 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsapi_client_test.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsapi_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,54 +17,75 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups" ) -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/CheckManagementGroupNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/CheckManagementGroupNameAvailability.json func ExampleAPIClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewAPIClient(cred, nil) + client, err := armmanagementgroups.NewAPIClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CheckNameAvailability(ctx, armmanagementgroups.CheckNameAvailabilityRequest{ - Name: to.StringPtr(""), - Type: to.StringPtr(""), + Name: to.Ptr(""), + Type: to.Ptr(""), }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.APIClientCheckNameAvailabilityResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/StartTenantBackfillRequest.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/StartTenantBackfillRequest.json func ExampleAPIClient_StartTenantBackfill() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewAPIClient(cred, nil) + client, err := armmanagementgroups.NewAPIClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.StartTenantBackfill(ctx, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.APIClientStartTenantBackfillResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/TenantBackfillStatusRequest.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/TenantBackfillStatusRequest.json func ExampleAPIClient_TenantBackfillStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewAPIClient(cred, nil) + client, err := armmanagementgroups.NewAPIClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.TenantBackfillStatus(ctx, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.APIClientTenantBackfillStatusResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsubscriptions_client_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsubscriptions_client_test.go index 460eea4224ad..e1687468d454 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsubscriptions_client_test.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsubscriptions_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,79 +17,103 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups" ) -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/AddManagementGroupSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/AddManagementGroupSubscription.json func ExampleManagementGroupSubscriptionsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewManagementGroupSubscriptionsClient(cred, nil) + client, err := armmanagementgroups.NewManagementGroupSubscriptionsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Create(ctx, "", "", - &armmanagementgroups.ManagementGroupSubscriptionsClientCreateOptions{CacheControl: to.StringPtr("")}) + &armmanagementgroups.ManagementGroupSubscriptionsClientCreateOptions{CacheControl: to.Ptr("")}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ManagementGroupSubscriptionsClientCreateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/RemoveManagementGroupSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/RemoveManagementGroupSubscription.json func ExampleManagementGroupSubscriptionsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewManagementGroupSubscriptionsClient(cred, nil) + client, err := armmanagementgroups.NewManagementGroupSubscriptionsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", - &armmanagementgroups.ManagementGroupSubscriptionsClientDeleteOptions{CacheControl: to.StringPtr("")}) + &armmanagementgroups.ManagementGroupSubscriptionsClientDeleteOptions{CacheControl: to.Ptr("")}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetSubscriptionFromManagementGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetSubscriptionFromManagementGroup.json func ExampleManagementGroupSubscriptionsClient_GetSubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewManagementGroupSubscriptionsClient(cred, nil) + client, err := armmanagementgroups.NewManagementGroupSubscriptionsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.GetSubscription(ctx, "", "", - &armmanagementgroups.ManagementGroupSubscriptionsClientGetSubscriptionOptions{CacheControl: to.StringPtr("")}) + &armmanagementgroups.ManagementGroupSubscriptionsClientGetSubscriptionOptions{CacheControl: to.Ptr("")}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ManagementGroupSubscriptionsClientGetSubscriptionResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetAllSubscriptionsFromManagementGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetAllSubscriptionsFromManagementGroup.json func ExampleManagementGroupSubscriptionsClient_GetSubscriptionsUnderManagementGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewManagementGroupSubscriptionsClient(cred, nil) + client, err := armmanagementgroups.NewManagementGroupSubscriptionsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.GetSubscriptionsUnderManagementGroup("", &armmanagementgroups.ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions{Skiptoken: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_operations_client_test.go index eaac08c3e51c..af220b8b6478 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_operations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,25 +16,29 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups" ) -// x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListOperations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListOperations.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementgroups.NewOperationsClient(cred, nil) + client, err := armmanagementgroups.NewOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_api_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_api_client.go index d4e3e2350576..15eba35ff27f 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_api_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_api_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,19 +29,23 @@ type APIClient struct { // NewAPIClient creates a new instance of APIClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewAPIClient(credential azcore.TokenCredential, options *arm.ClientOptions) *APIClient { +func NewAPIClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*APIClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &APIClient{ - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CheckNameAvailability - Checks if the specified management group name is valid and unique @@ -79,7 +84,7 @@ func (client *APIClient) checkNameAvailabilityCreateRequest(ctx context.Context, // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. func (client *APIClient) checkNameAvailabilityHandleResponse(resp *http.Response) (APIClientCheckNameAvailabilityResponse, error) { - result := APIClientCheckNameAvailabilityResponse{RawResponse: resp} + result := APIClientCheckNameAvailabilityResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { return APIClientCheckNameAvailabilityResponse{}, err } @@ -120,7 +125,7 @@ func (client *APIClient) startTenantBackfillCreateRequest(ctx context.Context, o // startTenantBackfillHandleResponse handles the StartTenantBackfill response. func (client *APIClient) startTenantBackfillHandleResponse(resp *http.Response) (APIClientStartTenantBackfillResponse, error) { - result := APIClientStartTenantBackfillResponse{RawResponse: resp} + result := APIClientStartTenantBackfillResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.TenantBackfillStatusResult); err != nil { return APIClientStartTenantBackfillResponse{}, err } @@ -162,7 +167,7 @@ func (client *APIClient) tenantBackfillStatusCreateRequest(ctx context.Context, // tenantBackfillStatusHandleResponse handles the TenantBackfillStatus response. func (client *APIClient) tenantBackfillStatusHandleResponse(resp *http.Response) (APIClientTenantBackfillStatusResponse, error) { - result := APIClientTenantBackfillStatusResponse{RawResponse: resp} + result := APIClientTenantBackfillStatusResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.TenantBackfillStatusResult); err != nil { return APIClientTenantBackfillStatusResponse{}, err } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_client.go index 48f76cb25d90..b5cc6dc20e8f 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -32,19 +33,23 @@ type Client struct { // NewClient creates a new instance of Client with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) *Client { +func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &Client{ - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Create or update a management group. If a management group is already created and a subsequent create @@ -53,22 +58,18 @@ func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) *C // groupID - Management Group ID. // createManagementGroupRequest - Management group creation parameters. // options - ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. -func (client *Client) BeginCreateOrUpdate(ctx context.Context, groupID string, createManagementGroupRequest CreateManagementGroupRequest, options *ClientBeginCreateOrUpdateOptions) (ClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, groupID, createManagementGroupRequest, options) - if err != nil { - return ClientCreateOrUpdatePollerResponse{}, err - } - result := ClientCreateOrUpdatePollerResponse{ - RawResponse: resp, +func (client *Client) BeginCreateOrUpdate(ctx context.Context, groupID string, createManagementGroupRequest CreateManagementGroupRequest, options *ClientBeginCreateOrUpdateOptions) (*armruntime.Poller[ClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, groupID, createManagementGroupRequest, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[ClientCreateOrUpdateResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[ClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("Client.CreateOrUpdate", "azure-async-operation", resp, client.pl) - if err != nil { - return ClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &ClientCreateOrUpdatePoller{ - pt: pt, - } - return result, nil } // CreateOrUpdate - Create or update a management group. If a management group is already created and a subsequent create @@ -114,22 +115,18 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, groupID s // If the operation fails it returns an *azcore.ResponseError type. // groupID - Management Group ID. // options - ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. -func (client *Client) BeginDelete(ctx context.Context, groupID string, options *ClientBeginDeleteOptions) (ClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, groupID, options) - if err != nil { - return ClientDeletePollerResponse{}, err - } - result := ClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("Client.Delete", "azure-async-operation", resp, client.pl) - if err != nil { - return ClientDeletePollerResponse{}, err +func (client *Client) BeginDelete(ctx context.Context, groupID string, options *ClientBeginDeleteOptions) (*armruntime.Poller[ClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, groupID, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[ClientDeleteResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[ClientDeleteResponse](options.ResumeToken, client.pl, nil) } - result.Poller = &ClientDeletePoller{ - pt: pt, - } - return result, nil } // Delete - Delete management group. If a management group contains child resources, the request will fail. @@ -221,7 +218,7 @@ func (client *Client) getCreateRequest(ctx context.Context, groupID string, opti // getHandleResponse handles the Get response. func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, error) { - result := ClientGetResponse{RawResponse: resp} + result := ClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementGroup); err != nil { return ClientGetResponse{}, err } @@ -232,16 +229,32 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // If the operation fails it returns an *azcore.ResponseError type. // groupID - Management Group ID. // options - ClientGetDescendantsOptions contains the optional parameters for the Client.GetDescendants method. -func (client *Client) GetDescendants(groupID string, options *ClientGetDescendantsOptions) *ClientGetDescendantsPager { - return &ClientGetDescendantsPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.getDescendantsCreateRequest(ctx, groupID, options) +func (client *Client) GetDescendants(groupID string, options *ClientGetDescendantsOptions) *runtime.Pager[ClientGetDescendantsResponse] { + return runtime.NewPager(runtime.PageProcessor[ClientGetDescendantsResponse]{ + More: func(page ClientGetDescendantsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ClientGetDescendantsResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DescendantListResult.NextLink) + Fetcher: func(ctx context.Context, page *ClientGetDescendantsResponse) (ClientGetDescendantsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getDescendantsCreateRequest(ctx, groupID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientGetDescendantsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientGetDescendantsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientGetDescendantsResponse{}, runtime.NewResponseError(resp) + } + return client.getDescendantsHandleResponse(resp) }, - } + }) } // getDescendantsCreateRequest creates the GetDescendants request. @@ -270,7 +283,7 @@ func (client *Client) getDescendantsCreateRequest(ctx context.Context, groupID s // getDescendantsHandleResponse handles the GetDescendants response. func (client *Client) getDescendantsHandleResponse(resp *http.Response) (ClientGetDescendantsResponse, error) { - result := ClientGetDescendantsResponse{RawResponse: resp} + result := ClientGetDescendantsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DescendantListResult); err != nil { return ClientGetDescendantsResponse{}, err } @@ -280,16 +293,32 @@ func (client *Client) getDescendantsHandleResponse(resp *http.Response) (ClientG // List - List management groups for the authenticated user. // If the operation fails it returns an *azcore.ResponseError type. // options - ClientListOptions contains the optional parameters for the Client.List method. -func (client *Client) List(options *ClientListOptions) *ClientListPager { - return &ClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *Client) List(options *ClientListOptions) *runtime.Pager[ClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ClientListResponse]{ + More: func(page ClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ManagementGroupListResult.NextLink) + Fetcher: func(ctx context.Context, page *ClientListResponse) (ClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -314,7 +343,7 @@ func (client *Client) listCreateRequest(ctx context.Context, options *ClientList // listHandleResponse handles the List response. func (client *Client) listHandleResponse(resp *http.Response) (ClientListResponse, error) { - result := ClientListResponse{RawResponse: resp} + result := ClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementGroupListResult); err != nil { return ClientListResponse{}, err } @@ -364,7 +393,7 @@ func (client *Client) updateCreateRequest(ctx context.Context, groupID string, p // updateHandleResponse handles the Update response. func (client *Client) updateHandleResponse(resp *http.Response) (ClientUpdateResponse, error) { - result := ClientUpdateResponse{RawResponse: resp} + result := ClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementGroup); err != nil { return ClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_constants.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_constants.go index a50dfc21802e..312da595269f 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_constants.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armmanagementgroups const ( moduleName = "armmanagementgroups" - moduleVersion = "v0.4.0" + moduleVersion = "v0.5.0" ) type EntitySearchType string @@ -34,11 +34,6 @@ func PossibleEntitySearchTypeValues() []EntitySearchType { } } -// ToPtr returns a *EntitySearchType pointing to the current value. -func (c EntitySearchType) ToPtr() *EntitySearchType { - return &c -} - type EntityViewParameterType string const ( @@ -58,11 +53,6 @@ func PossibleEntityViewParameterTypeValues() []EntityViewParameterType { } } -// ToPtr returns a *EntityViewParameterType pointing to the current value. -func (c EntityViewParameterType) ToPtr() *EntityViewParameterType { - return &c -} - // ManagementGroupChildType - The type of child resource. type ManagementGroupChildType string @@ -79,11 +69,6 @@ func PossibleManagementGroupChildTypeValues() []ManagementGroupChildType { } } -// ToPtr returns a *ManagementGroupChildType pointing to the current value. -func (c ManagementGroupChildType) ToPtr() *ManagementGroupChildType { - return &c -} - type ManagementGroupExpandType string const ( @@ -101,11 +86,6 @@ func PossibleManagementGroupExpandTypeValues() []ManagementGroupExpandType { } } -// ToPtr returns a *ManagementGroupExpandType pointing to the current value. -func (c ManagementGroupExpandType) ToPtr() *ManagementGroupExpandType { - return &c -} - // Permissions - The users specific permissions to this item. type Permissions string @@ -126,11 +106,6 @@ func PossiblePermissionsValues() []Permissions { } } -// ToPtr returns a *Permissions pointing to the current value. -func (c Permissions) ToPtr() *Permissions { - return &c -} - // Reason - Required if nameAvailable == false. Invalid indicates the name provided does not match the resource provider's // naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists // indicates that the name is already in use and is therefore unavailable. @@ -149,11 +124,6 @@ func PossibleReasonValues() []Reason { } } -// ToPtr returns a *Reason pointing to the current value. -func (c Reason) ToPtr() *Reason { - return &c -} - // Status - The status of the Tenant Backfill type Status string @@ -177,8 +147,3 @@ func PossibleStatusValues() []Status { StatusCompleted, } } - -// ToPtr returns a *Status pointing to the current value. -func (c Status) ToPtr() *Status { - return &c -} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_entities_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_entities_client.go index e8b398f39146..72418725b426 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_entities_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_entities_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,34 +30,54 @@ type EntitiesClient struct { // NewEntitiesClient creates a new instance of EntitiesClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewEntitiesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *EntitiesClient { +func NewEntitiesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EntitiesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &EntitiesClient{ - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // List - List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. // If the operation fails it returns an *azcore.ResponseError type. // options - EntitiesClientListOptions contains the optional parameters for the EntitiesClient.List method. -func (client *EntitiesClient) List(options *EntitiesClientListOptions) *EntitiesClientListPager { - return &EntitiesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *EntitiesClient) List(options *EntitiesClientListOptions) *runtime.Pager[EntitiesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[EntitiesClientListResponse]{ + More: func(page EntitiesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp EntitiesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.EntityListResult.NextLink) + Fetcher: func(ctx context.Context, page *EntitiesClientListResponse) (EntitiesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return EntitiesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return EntitiesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return EntitiesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -102,7 +123,7 @@ func (client *EntitiesClient) listCreateRequest(ctx context.Context, options *En // listHandleResponse handles the List response. func (client *EntitiesClient) listHandleResponse(resp *http.Response) (EntitiesClientListResponse, error) { - result := EntitiesClientListResponse{RawResponse: resp} + result := EntitiesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.EntityListResult); err != nil { return EntitiesClientListResponse{}, err } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_hierarchysettings_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_hierarchysettings_client.go index b5b41a23c379..8ba3bc44b6c8 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_hierarchysettings_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_hierarchysettings_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -31,19 +32,23 @@ type HierarchySettingsClient struct { // NewHierarchySettingsClient creates a new instance of HierarchySettingsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewHierarchySettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *HierarchySettingsClient { +func NewHierarchySettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*HierarchySettingsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &HierarchySettingsClient{ - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Creates or updates the hierarchy settings defined at the Management Group level. @@ -87,7 +92,7 @@ func (client *HierarchySettingsClient) createOrUpdateCreateRequest(ctx context.C // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *HierarchySettingsClient) createOrUpdateHandleResponse(resp *http.Response) (HierarchySettingsClientCreateOrUpdateResponse, error) { - result := HierarchySettingsClientCreateOrUpdateResponse{RawResponse: resp} + result := HierarchySettingsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.HierarchySettings); err != nil { return HierarchySettingsClientCreateOrUpdateResponse{}, err } @@ -111,7 +116,7 @@ func (client *HierarchySettingsClient) Delete(ctx context.Context, groupID strin if !runtime.HasStatusCode(resp, http.StatusOK) { return HierarchySettingsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return HierarchySettingsClientDeleteResponse{RawResponse: resp}, nil + return HierarchySettingsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -172,7 +177,7 @@ func (client *HierarchySettingsClient) getCreateRequest(ctx context.Context, gro // getHandleResponse handles the Get response. func (client *HierarchySettingsClient) getHandleResponse(resp *http.Response) (HierarchySettingsClientGetResponse, error) { - result := HierarchySettingsClientGetResponse{RawResponse: resp} + result := HierarchySettingsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.HierarchySettings); err != nil { return HierarchySettingsClientGetResponse{}, err } @@ -219,7 +224,7 @@ func (client *HierarchySettingsClient) listCreateRequest(ctx context.Context, gr // listHandleResponse handles the List response. func (client *HierarchySettingsClient) listHandleResponse(resp *http.Response) (HierarchySettingsClientListResponse, error) { - result := HierarchySettingsClientListResponse{RawResponse: resp} + result := HierarchySettingsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.HierarchySettingsList); err != nil { return HierarchySettingsClientListResponse{}, err } @@ -267,7 +272,7 @@ func (client *HierarchySettingsClient) updateCreateRequest(ctx context.Context, // updateHandleResponse handles the Update response. func (client *HierarchySettingsClient) updateHandleResponse(resp *http.Response) (HierarchySettingsClientUpdateResponse, error) { - result := HierarchySettingsClientUpdateResponse{RawResponse: resp} + result := HierarchySettingsClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.HierarchySettings); err != nil { return HierarchySettingsClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsubscriptions_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsubscriptions_client.go index 8577ed2362ff..a939c22aa9c9 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsubscriptions_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsubscriptions_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -31,19 +32,23 @@ type ManagementGroupSubscriptionsClient struct { // NewManagementGroupSubscriptionsClient creates a new instance of ManagementGroupSubscriptionsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewManagementGroupSubscriptionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ManagementGroupSubscriptionsClient { +func NewManagementGroupSubscriptionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagementGroupSubscriptionsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ManagementGroupSubscriptionsClient{ - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // Create - Associates existing subscription with the management group. @@ -94,7 +99,7 @@ func (client *ManagementGroupSubscriptionsClient) createCreateRequest(ctx contex // createHandleResponse handles the Create response. func (client *ManagementGroupSubscriptionsClient) createHandleResponse(resp *http.Response) (ManagementGroupSubscriptionsClientCreateResponse, error) { - result := ManagementGroupSubscriptionsClientCreateResponse{RawResponse: resp} + result := ManagementGroupSubscriptionsClientCreateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionUnderManagementGroup); err != nil { return ManagementGroupSubscriptionsClientCreateResponse{}, err } @@ -119,7 +124,7 @@ func (client *ManagementGroupSubscriptionsClient) Delete(ctx context.Context, gr if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return ManagementGroupSubscriptionsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return ManagementGroupSubscriptionsClientDeleteResponse{RawResponse: resp}, nil + return ManagementGroupSubscriptionsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -195,7 +200,7 @@ func (client *ManagementGroupSubscriptionsClient) getSubscriptionCreateRequest(c // getSubscriptionHandleResponse handles the GetSubscription response. func (client *ManagementGroupSubscriptionsClient) getSubscriptionHandleResponse(resp *http.Response) (ManagementGroupSubscriptionsClientGetSubscriptionResponse, error) { - result := ManagementGroupSubscriptionsClientGetSubscriptionResponse{RawResponse: resp} + result := ManagementGroupSubscriptionsClientGetSubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionUnderManagementGroup); err != nil { return ManagementGroupSubscriptionsClientGetSubscriptionResponse{}, err } @@ -208,16 +213,32 @@ func (client *ManagementGroupSubscriptionsClient) getSubscriptionHandleResponse( // groupID - Management Group ID. // options - ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions contains the optional parameters // for the ManagementGroupSubscriptionsClient.GetSubscriptionsUnderManagementGroup method. -func (client *ManagementGroupSubscriptionsClient) GetSubscriptionsUnderManagementGroup(groupID string, options *ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions) *ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupPager { - return &ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.getSubscriptionsUnderManagementGroupCreateRequest(ctx, groupID, options) +func (client *ManagementGroupSubscriptionsClient) GetSubscriptionsUnderManagementGroup(groupID string, options *ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions) *runtime.Pager[ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse]{ + More: func(page ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ListSubscriptionUnderManagementGroup.NextLink) + Fetcher: func(ctx context.Context, page *ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse) (ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getSubscriptionsUnderManagementGroupCreateRequest(ctx, groupID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse{}, runtime.NewResponseError(resp) + } + return client.getSubscriptionsUnderManagementGroupHandleResponse(resp) }, - } + }) } // getSubscriptionsUnderManagementGroupCreateRequest creates the GetSubscriptionsUnderManagementGroup request. @@ -243,7 +264,7 @@ func (client *ManagementGroupSubscriptionsClient) getSubscriptionsUnderManagemen // getSubscriptionsUnderManagementGroupHandleResponse handles the GetSubscriptionsUnderManagementGroup response. func (client *ManagementGroupSubscriptionsClient) getSubscriptionsUnderManagementGroupHandleResponse(resp *http.Response) (ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse, error) { - result := ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse{RawResponse: resp} + result := ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListSubscriptionUnderManagementGroup); err != nil { return ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse{}, err } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models.go index e43723bcf659..d4e8c9b07924 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armmanagementgroups -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // APIClientCheckNameAvailabilityOptions contains the optional parameters for the APIClient.CheckNameAvailability method. type APIClientCheckNameAvailabilityOptions struct { @@ -78,12 +73,16 @@ type CheckNameAvailabilityResult struct { type ClientBeginCreateOrUpdateOptions struct { // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. CacheControl *string + // Resumes the LRO from the provided token. + ResumeToken string } // ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. type ClientBeginDeleteOptions struct { // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. CacheControl *string + // Resumes the LRO from the provided token. + ResumeToken string } // ClientGetDescendantsOptions contains the optional parameters for the Client.GetDescendants method. @@ -145,17 +144,6 @@ type CreateManagementGroupChildInfo struct { Type *ManagementGroupChildType `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type CreateManagementGroupChildInfo. -func (c CreateManagementGroupChildInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "children", c.Children) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - // CreateManagementGroupDetails - The details of a management group used during creation. type CreateManagementGroupDetails struct { // (Optional) The ID of the parent management group used during creation. @@ -171,45 +159,6 @@ type CreateManagementGroupDetails struct { Version *int32 `json:"version,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type CreateManagementGroupDetails. -func (c CreateManagementGroupDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "parent", c.Parent) - populate(objectMap, "updatedBy", c.UpdatedBy) - populateTimeRFC3339(objectMap, "updatedTime", c.UpdatedTime) - populate(objectMap, "version", c.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CreateManagementGroupDetails. -func (c *CreateManagementGroupDetails) 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 "parent": - err = unpopulate(val, &c.Parent) - delete(rawMsg, key) - case "updatedBy": - err = unpopulate(val, &c.UpdatedBy) - delete(rawMsg, key) - case "updatedTime": - err = unpopulateTimeRFC3339(val, &c.UpdatedTime) - delete(rawMsg, key) - case "version": - err = unpopulate(val, &c.Version) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // CreateManagementGroupProperties - The generic properties of a management group used during creation. type CreateManagementGroupProperties struct { // The details of a management group used during creation. @@ -225,16 +174,6 @@ type CreateManagementGroupProperties struct { TenantID *string `json:"tenantId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type CreateManagementGroupProperties. -func (c CreateManagementGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "children", c.Children) - populate(objectMap, "details", c.Details) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "tenantId", c.TenantID) - return json.Marshal(objectMap) -} - // CreateManagementGroupRequest - Management group creation parameters. type CreateManagementGroupRequest struct { // The name of the management group. For example, 00000000-0000-0000-0000-000000000000 @@ -268,13 +207,6 @@ type CreateOrUpdateSettingsRequest struct { Properties *CreateOrUpdateSettingsProperties `json:"properties,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CreateOrUpdateSettingsRequest. -func (c CreateOrUpdateSettingsRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", c.Properties) - return json.Marshal(objectMap) -} - // CreateParentGroupInfo - (Optional) The ID of the parent management group used during creation. type CreateParentGroupInfo struct { // The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 @@ -321,14 +253,6 @@ type DescendantListResult struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type DescendantListResult. -func (d DescendantListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - // DescendantParentGroupInfo - The ID of the parent management group. type DescendantParentGroupInfo struct { // The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 @@ -376,6 +300,33 @@ type EntitiesClientListOptions struct { View *EntityViewParameterType } +// EntityHierarchyItem - The management group details for the hierarchy view. +type EntityHierarchyItem struct { + // The generic properties of a management group. + Properties *EntityHierarchyItemProperties `json:"properties,omitempty"` + + // READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000 + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups + Type *string `json:"type,omitempty" azure:"ro"` +} + +// EntityHierarchyItemProperties - The generic properties of a management group. +type EntityHierarchyItemProperties struct { + // The list of children. + Children []*EntityHierarchyItem `json:"children,omitempty"` + + // The friendly name of the management group. + DisplayName *string `json:"displayName,omitempty"` + + // The users specific permissions to this item. + Permissions *Permissions `json:"permissions,omitempty"` +} + // EntityInfo - The entity. type EntityInfo struct { // The generic properties of an entity. @@ -424,22 +375,6 @@ type EntityInfoProperties struct { TenantID *string `json:"tenantId,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type EntityInfoProperties. -func (e EntityInfoProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", e.DisplayName) - populate(objectMap, "inheritedPermissions", e.InheritedPermissions) - populate(objectMap, "numberOfChildGroups", e.NumberOfChildGroups) - populate(objectMap, "numberOfChildren", e.NumberOfChildren) - populate(objectMap, "numberOfDescendants", e.NumberOfDescendants) - populate(objectMap, "parent", e.Parent) - populate(objectMap, "parentDisplayNameChain", e.ParentDisplayNameChain) - populate(objectMap, "parentNameChain", e.ParentNameChain) - populate(objectMap, "permissions", e.Permissions) - populate(objectMap, "tenantId", e.TenantID) - return json.Marshal(objectMap) -} - // EntityListResult - Describes the result of the request to view entities. type EntityListResult struct { // The list of entities. @@ -452,21 +387,30 @@ type EntityListResult struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type EntityListResult. -func (e EntityListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "count", e.Count) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - // EntityParentGroupInfo - (Optional) The ID of the parent management group. type EntityParentGroupInfo struct { // The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 ID *string `json:"id,omitempty"` } +// ErrorDetails - The details of the error. +type ErrorDetails struct { + // One of a server-defined set of error codes. + Code *string `json:"code,omitempty"` + + // A human-readable representation of the error's details. + Details *string `json:"details,omitempty"` + + // A human-readable representation of the error. + Message *string `json:"message,omitempty"` +} + +// ErrorResponse - The error object. +type ErrorResponse struct { + // The details of the error. + Error *ErrorDetails `json:"error,omitempty"` +} + // HierarchySettings - Settings defined at the Management Group scope. type HierarchySettings struct { // The generic properties of hierarchy settings. @@ -532,14 +476,6 @@ type HierarchySettingsList struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type HierarchySettingsList. -func (h HierarchySettingsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", h.NextLink) - populate(objectMap, "value", h.Value) - return json.Marshal(objectMap) -} - // HierarchySettingsProperties - The generic properties of hierarchy settings. type HierarchySettingsProperties struct { // Settings that sets the default Management Group under which new subscriptions get added in this tenant. For example, /providers/Microsoft.Management/managementGroups/defaultGroup @@ -564,14 +500,6 @@ type ListSubscriptionUnderManagementGroup struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ListSubscriptionUnderManagementGroup. -func (l ListSubscriptionUnderManagementGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", l.NextLink) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - // ManagementGroup - The management group details. type ManagementGroup struct { // The generic properties of a management group. @@ -605,17 +533,6 @@ type ManagementGroupChildInfo struct { Type *ManagementGroupChildType `json:"type,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ManagementGroupChildInfo. -func (m ManagementGroupChildInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "children", m.Children) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "id", m.ID) - populate(objectMap, "name", m.Name) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - // ManagementGroupDetails - The details of a management group. type ManagementGroupDetails struct { // The ancestors of the management group. @@ -640,57 +557,6 @@ type ManagementGroupDetails struct { Version *int32 `json:"version,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ManagementGroupDetails. -func (m ManagementGroupDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "managementGroupAncestors", m.ManagementGroupAncestors) - populate(objectMap, "managementGroupAncestorsChain", m.ManagementGroupAncestorsChain) - populate(objectMap, "parent", m.Parent) - populate(objectMap, "path", m.Path) - populate(objectMap, "updatedBy", m.UpdatedBy) - populateTimeRFC3339(objectMap, "updatedTime", m.UpdatedTime) - populate(objectMap, "version", m.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementGroupDetails. -func (m *ManagementGroupDetails) 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 "managementGroupAncestors": - err = unpopulate(val, &m.ManagementGroupAncestors) - delete(rawMsg, key) - case "managementGroupAncestorsChain": - err = unpopulate(val, &m.ManagementGroupAncestorsChain) - delete(rawMsg, key) - case "parent": - err = unpopulate(val, &m.Parent) - delete(rawMsg, key) - case "path": - err = unpopulate(val, &m.Path) - delete(rawMsg, key) - case "updatedBy": - err = unpopulate(val, &m.UpdatedBy) - delete(rawMsg, key) - case "updatedTime": - err = unpopulateTimeRFC3339(val, &m.UpdatedTime) - delete(rawMsg, key) - case "version": - err = unpopulate(val, &m.Version) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ManagementGroupInfo - The management group resource. type ManagementGroupInfo struct { // The generic properties of a management group. @@ -724,14 +590,6 @@ type ManagementGroupListResult struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ManagementGroupListResult. -func (m ManagementGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", m.NextLink) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - // ManagementGroupPathElement - A path element of a management group ancestors. type ManagementGroupPathElement struct { // The friendly name of the group. @@ -756,16 +614,6 @@ type ManagementGroupProperties struct { TenantID *string `json:"tenantId,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ManagementGroupProperties. -func (m ManagementGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "children", m.Children) - populate(objectMap, "details", m.Details) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "tenantId", m.TenantID) - return json.Marshal(objectMap) -} - // ManagementGroupSubscriptionsClientCreateOptions contains the optional parameters for the ManagementGroupSubscriptionsClient.Create // method. type ManagementGroupSubscriptionsClientCreateOptions struct { @@ -829,12 +677,19 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) +// OperationResults - The results of an asynchronous operation. +type OperationResults struct { + // The generic properties of a management group. + Properties *ManagementGroupInfoProperties `json:"properties,omitempty"` + + // READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000 + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups + Type *string `json:"type,omitempty" azure:"ro"` } // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. @@ -863,14 +718,6 @@ type PatchManagementGroupRequest struct { ParentGroupID *string `json:"parentGroupId,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PatchManagementGroupRequest. -func (p PatchManagementGroupRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "parentGroupId", p.ParentGroupID) - return json.Marshal(objectMap) -} - // SubscriptionUnderManagementGroup - The details of subscription under management group. type SubscriptionUnderManagementGroup struct { // The generic properties of subscription under a management group. @@ -909,20 +756,3 @@ type TenantBackfillStatusResult struct { // READ-ONLY; The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 TenantID *string `json:"tenantId,omitempty" azure:"ro"` } - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models_serde.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models_serde.go new file mode 100644 index 000000000000..55cb7c39da9a --- /dev/null +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models_serde.go @@ -0,0 +1,253 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmanagementgroups + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type CreateManagementGroupChildInfo. +func (c CreateManagementGroupChildInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "children", c.Children) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CreateManagementGroupDetails. +func (c CreateManagementGroupDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "parent", c.Parent) + populate(objectMap, "updatedBy", c.UpdatedBy) + populateTimeRFC3339(objectMap, "updatedTime", c.UpdatedTime) + populate(objectMap, "version", c.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateManagementGroupDetails. +func (c *CreateManagementGroupDetails) 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 "parent": + err = unpopulate(val, &c.Parent) + delete(rawMsg, key) + case "updatedBy": + err = unpopulate(val, &c.UpdatedBy) + delete(rawMsg, key) + case "updatedTime": + err = unpopulateTimeRFC3339(val, &c.UpdatedTime) + delete(rawMsg, key) + case "version": + err = unpopulate(val, &c.Version) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CreateManagementGroupProperties. +func (c CreateManagementGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "children", c.Children) + populate(objectMap, "details", c.Details) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "tenantId", c.TenantID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CreateOrUpdateSettingsRequest. +func (c CreateOrUpdateSettingsRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DescendantListResult. +func (d DescendantListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type EntityHierarchyItemProperties. +func (e EntityHierarchyItemProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "children", e.Children) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "permissions", e.Permissions) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type EntityInfoProperties. +func (e EntityInfoProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "inheritedPermissions", e.InheritedPermissions) + populate(objectMap, "numberOfChildGroups", e.NumberOfChildGroups) + populate(objectMap, "numberOfChildren", e.NumberOfChildren) + populate(objectMap, "numberOfDescendants", e.NumberOfDescendants) + populate(objectMap, "parent", e.Parent) + populate(objectMap, "parentDisplayNameChain", e.ParentDisplayNameChain) + populate(objectMap, "parentNameChain", e.ParentNameChain) + populate(objectMap, "permissions", e.Permissions) + populate(objectMap, "tenantId", e.TenantID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type EntityListResult. +func (e EntityListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "count", e.Count) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type HierarchySettingsList. +func (h HierarchySettingsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ListSubscriptionUnderManagementGroup. +func (l ListSubscriptionUnderManagementGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementGroupChildInfo. +func (m ManagementGroupChildInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "children", m.Children) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementGroupDetails. +func (m ManagementGroupDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "managementGroupAncestors", m.ManagementGroupAncestors) + populate(objectMap, "managementGroupAncestorsChain", m.ManagementGroupAncestorsChain) + populate(objectMap, "parent", m.Parent) + populate(objectMap, "path", m.Path) + populate(objectMap, "updatedBy", m.UpdatedBy) + populateTimeRFC3339(objectMap, "updatedTime", m.UpdatedTime) + populate(objectMap, "version", m.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementGroupDetails. +func (m *ManagementGroupDetails) 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 "managementGroupAncestors": + err = unpopulate(val, &m.ManagementGroupAncestors) + delete(rawMsg, key) + case "managementGroupAncestorsChain": + err = unpopulate(val, &m.ManagementGroupAncestorsChain) + delete(rawMsg, key) + case "parent": + err = unpopulate(val, &m.Parent) + delete(rawMsg, key) + case "path": + err = unpopulate(val, &m.Path) + delete(rawMsg, key) + case "updatedBy": + err = unpopulate(val, &m.UpdatedBy) + delete(rawMsg, key) + case "updatedTime": + err = unpopulateTimeRFC3339(val, &m.UpdatedTime) + delete(rawMsg, key) + case "version": + err = unpopulate(val, &m.Version) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementGroupListResult. +func (m ManagementGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementGroupProperties. +func (m ManagementGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "children", m.Children) + populate(objectMap, "details", m.Details) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PatchManagementGroupRequest. +func (p PatchManagementGroupRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "parentGroupId", p.ParentGroupID) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_operations_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_operations_client.go index abd76055e715..617490115dca 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_operations_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,34 +29,54 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // List - Lists all of the available Management REST API operations. // If the operation fails it returns an *azcore.ResponseError type. // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(options *OperationsClientListOptions) *OperationsClientListPager { - return &OperationsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *OperationsClient) List(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp OperationsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationListResult.NextLink) + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -74,7 +95,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pagers.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pagers.go deleted file mode 100644 index 882f383f7410..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pagers.go +++ /dev/null @@ -1,287 +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 armmanagementgroups - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// ClientGetDescendantsPager provides operations for iterating over paged responses. -type ClientGetDescendantsPager struct { - client *Client - current ClientGetDescendantsResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ClientGetDescendantsResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ClientGetDescendantsPager) 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 *ClientGetDescendantsPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DescendantListResult.NextLink == nil || len(*p.current.DescendantListResult.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.getDescendantsHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ClientGetDescendantsResponse page. -func (p *ClientGetDescendantsPager) PageResponse() ClientGetDescendantsResponse { - return p.current -} - -// ClientListPager provides operations for iterating over paged responses. -type ClientListPager struct { - client *Client - current ClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ClientListPager) 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 *ClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ManagementGroupListResult.NextLink == nil || len(*p.current.ManagementGroupListResult.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 = runtime.NewResponseError(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 ClientListResponse page. -func (p *ClientListPager) PageResponse() ClientListResponse { - return p.current -} - -// EntitiesClientListPager provides operations for iterating over paged responses. -type EntitiesClientListPager struct { - client *EntitiesClient - current EntitiesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, EntitiesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *EntitiesClientListPager) 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 *EntitiesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.EntityListResult.NextLink == nil || len(*p.current.EntityListResult.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 = runtime.NewResponseError(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 EntitiesClientListResponse page. -func (p *EntitiesClientListPager) PageResponse() EntitiesClientListResponse { - return p.current -} - -// ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupPager provides operations for iterating over paged responses. -type ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupPager struct { - client *ManagementGroupSubscriptionsClient - current ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupPager) 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 *ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ListSubscriptionUnderManagementGroup.NextLink == nil || len(*p.current.ListSubscriptionUnderManagementGroup.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.getSubscriptionsUnderManagementGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse page. -func (p *ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupPager) PageResponse() ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse { - return p.current -} - -// OperationsClientListPager provides operations for iterating over paged responses. -type OperationsClientListPager struct { - client *OperationsClient - current OperationsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, OperationsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *OperationsClientListPager) 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 *OperationsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.OperationListResult.NextLink == nil || len(*p.current.OperationListResult.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 = runtime.NewResponseError(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 OperationsClientListResponse page. -func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse { - return p.current -} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pollers.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pollers.go deleted file mode 100644 index 56658856e990..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pollers.go +++ /dev/null @@ -1,101 +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 armmanagementgroups - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// ClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type ClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ClientCreateOrUpdatePoller) 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 *ClientCreateOrUpdatePoller) 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 ClientCreateOrUpdateResponse will be returned. -func (p *ClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (ClientCreateOrUpdateResponse, error) { - respType := ClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ManagementGroup) - if err != nil { - return ClientCreateOrUpdateResponse{}, 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 *ClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type ClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ClientDeletePoller) 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 *ClientDeletePoller) 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 ClientDeleteResponse will be returned. -func (p *ClientDeletePoller) FinalResponse(ctx context.Context) (ClientDeleteResponse, error) { - respType := ClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.AzureAsyncOperationResults) - if err != nil { - return ClientDeleteResponse{}, 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 *ClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_response_types.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_response_types.go index 64fe4a82e382..75cf2ff914c7 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_response_types.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,317 +8,102 @@ package armmanagementgroups -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - // APIClientCheckNameAvailabilityResponse contains the response from method APIClient.CheckNameAvailability. type APIClientCheckNameAvailabilityResponse struct { - APIClientCheckNameAvailabilityResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// APIClientCheckNameAvailabilityResult contains the result from method APIClient.CheckNameAvailability. -type APIClientCheckNameAvailabilityResult struct { CheckNameAvailabilityResult } // APIClientStartTenantBackfillResponse contains the response from method APIClient.StartTenantBackfill. type APIClientStartTenantBackfillResponse struct { - APIClientStartTenantBackfillResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// APIClientStartTenantBackfillResult contains the result from method APIClient.StartTenantBackfill. -type APIClientStartTenantBackfillResult struct { TenantBackfillStatusResult } // APIClientTenantBackfillStatusResponse contains the response from method APIClient.TenantBackfillStatus. type APIClientTenantBackfillStatusResponse struct { - APIClientTenantBackfillStatusResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// APIClientTenantBackfillStatusResult contains the result from method APIClient.TenantBackfillStatus. -type APIClientTenantBackfillStatusResult struct { TenantBackfillStatusResult } -// ClientCreateOrUpdatePollerResponse contains the response from method Client.CreateOrUpdate. -type ClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *ClientCreateOrUpdatePoller - - // 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 ClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClientCreateOrUpdateResponse, error) { - respType := ClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagementGroup) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *ClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *Client, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("Client.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &ClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ClientCreateOrUpdateResponse contains the response from method Client.CreateOrUpdate. type ClientCreateOrUpdateResponse struct { - ClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientCreateOrUpdateResult contains the result from method Client.CreateOrUpdate. -type ClientCreateOrUpdateResult struct { ManagementGroup } -// ClientDeletePollerResponse contains the response from method Client.Delete. -type ClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *ClientDeletePoller - - // 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 ClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClientDeleteResponse, error) { - respType := ClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AzureAsyncOperationResults) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ClientDeletePollerResponse from the provided client and resume token. -func (l *ClientDeletePollerResponse) Resume(ctx context.Context, client *Client, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("Client.Delete", token, client.pl) - if err != nil { - return err - } - poller := &ClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ClientDeleteResponse contains the response from method Client.Delete. type ClientDeleteResponse struct { - ClientDeleteResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientDeleteResult contains the result from method Client.Delete. -type ClientDeleteResult struct { AzureAsyncOperationResults } // ClientGetDescendantsResponse contains the response from method Client.GetDescendants. type ClientGetDescendantsResponse struct { - ClientGetDescendantsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientGetDescendantsResult contains the result from method Client.GetDescendants. -type ClientGetDescendantsResult struct { DescendantListResult } // ClientGetResponse contains the response from method Client.Get. type ClientGetResponse struct { - ClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientGetResult contains the result from method Client.Get. -type ClientGetResult struct { ManagementGroup } // ClientListResponse contains the response from method Client.List. type ClientListResponse struct { - ClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListResult contains the result from method Client.List. -type ClientListResult struct { ManagementGroupListResult } // ClientUpdateResponse contains the response from method Client.Update. type ClientUpdateResponse struct { - ClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientUpdateResult contains the result from method Client.Update. -type ClientUpdateResult struct { ManagementGroup } // EntitiesClientListResponse contains the response from method EntitiesClient.List. type EntitiesClientListResponse struct { - EntitiesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// EntitiesClientListResult contains the result from method EntitiesClient.List. -type EntitiesClientListResult struct { EntityListResult } // HierarchySettingsClientCreateOrUpdateResponse contains the response from method HierarchySettingsClient.CreateOrUpdate. type HierarchySettingsClientCreateOrUpdateResponse struct { - HierarchySettingsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// HierarchySettingsClientCreateOrUpdateResult contains the result from method HierarchySettingsClient.CreateOrUpdate. -type HierarchySettingsClientCreateOrUpdateResult struct { HierarchySettings } // HierarchySettingsClientDeleteResponse contains the response from method HierarchySettingsClient.Delete. type HierarchySettingsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // HierarchySettingsClientGetResponse contains the response from method HierarchySettingsClient.Get. type HierarchySettingsClientGetResponse struct { - HierarchySettingsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// HierarchySettingsClientGetResult contains the result from method HierarchySettingsClient.Get. -type HierarchySettingsClientGetResult struct { HierarchySettings } // HierarchySettingsClientListResponse contains the response from method HierarchySettingsClient.List. type HierarchySettingsClientListResponse struct { - HierarchySettingsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// HierarchySettingsClientListResult contains the result from method HierarchySettingsClient.List. -type HierarchySettingsClientListResult struct { HierarchySettingsList } // HierarchySettingsClientUpdateResponse contains the response from method HierarchySettingsClient.Update. type HierarchySettingsClientUpdateResponse struct { - HierarchySettingsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// HierarchySettingsClientUpdateResult contains the result from method HierarchySettingsClient.Update. -type HierarchySettingsClientUpdateResult struct { HierarchySettings } // ManagementGroupSubscriptionsClientCreateResponse contains the response from method ManagementGroupSubscriptionsClient.Create. type ManagementGroupSubscriptionsClientCreateResponse struct { - ManagementGroupSubscriptionsClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ManagementGroupSubscriptionsClientCreateResult contains the result from method ManagementGroupSubscriptionsClient.Create. -type ManagementGroupSubscriptionsClientCreateResult struct { SubscriptionUnderManagementGroup } // ManagementGroupSubscriptionsClientDeleteResponse contains the response from method ManagementGroupSubscriptionsClient.Delete. type ManagementGroupSubscriptionsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // ManagementGroupSubscriptionsClientGetSubscriptionResponse contains the response from method ManagementGroupSubscriptionsClient.GetSubscription. type ManagementGroupSubscriptionsClientGetSubscriptionResponse struct { - ManagementGroupSubscriptionsClientGetSubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ManagementGroupSubscriptionsClientGetSubscriptionResult contains the result from method ManagementGroupSubscriptionsClient.GetSubscription. -type ManagementGroupSubscriptionsClientGetSubscriptionResult struct { SubscriptionUnderManagementGroup } // ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse contains the response from method ManagementGroupSubscriptionsClient.GetSubscriptionsUnderManagementGroup. type ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse struct { - ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResult contains the result from method ManagementGroupSubscriptionsClient.GetSubscriptionsUnderManagementGroup. -type ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResult struct { ListSubscriptionUnderManagementGroup } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationListResult } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_time_rfc3339.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_time_rfc3339.go index 91ad309b0af7..2965adbb758d 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/CHANGELOG.md b/sdk/resourcemanager/managementpartner/armmanagementpartner/CHANGELOG.md index 782e7b756702..4b6790753759 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/CHANGELOG.md +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/CHANGELOG.md @@ -1,5 +1,43 @@ # Release History +## 0.3.0 (2022-04-12) +### Breaking Changes + +- Function `*OperationClient.List` return value(s) have been changed from `(*OperationClientListPager)` to `(*runtime.Pager[OperationClientListResponse])` +- Function `NewPartnersClient` return value(s) have been changed from `(*PartnersClient)` to `(*PartnersClient, error)` +- Function `NewPartnerClient` return value(s) have been changed from `(*PartnerClient)` to `(*PartnerClient, error)` +- Function `NewOperationClient` return value(s) have been changed from `(*OperationClient)` to `(*OperationClient, error)` +- Function `*OperationClientListPager.Err` has been removed +- Function `*OperationClientListPager.NextPage` has been removed +- Function `ManagementPartnerState.ToPtr` has been removed +- Function `*OperationClientListPager.PageResponse` has been removed +- Struct `OperationClientListPager` has been removed +- Struct `OperationClientListResult` has been removed +- Struct `PartnerClientCreateResult` has been removed +- Struct `PartnerClientGetResult` has been removed +- Struct `PartnerClientUpdateResult` has been removed +- Struct `PartnersClientGetResult` has been removed +- Field `PartnerClientCreateResult` of struct `PartnerClientCreateResponse` has been removed +- Field `RawResponse` of struct `PartnerClientCreateResponse` has been removed +- Field `PartnersClientGetResult` of struct `PartnersClientGetResponse` has been removed +- Field `RawResponse` of struct `PartnersClientGetResponse` has been removed +- Field `PartnerClientGetResult` of struct `PartnerClientGetResponse` has been removed +- Field `RawResponse` of struct `PartnerClientGetResponse` has been removed +- Field `RawResponse` of struct `PartnerClientDeleteResponse` has been removed +- Field `PartnerClientUpdateResult` of struct `PartnerClientUpdateResponse` has been removed +- Field `RawResponse` of struct `PartnerClientUpdateResponse` has been removed +- Field `OperationClientListResult` of struct `OperationClientListResponse` has been removed +- Field `RawResponse` of struct `OperationClientListResponse` has been removed + +### Features Added + +- New anonymous field `OperationList` in struct `OperationClientListResponse` +- New anonymous field `PartnerResponse` in struct `PartnerClientUpdateResponse` +- New anonymous field `PartnerResponse` in struct `PartnersClientGetResponse` +- New anonymous field `PartnerResponse` in struct `PartnerClientCreateResponse` +- New anonymous field `PartnerResponse` in struct `PartnerClientGetResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/README.md b/sdk/resourcemanager/managementpartner/armmanagementpartner/README.md index ca8bac67726d..9137d63abcb7 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/README.md +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/README.md @@ -11,7 +11,7 @@ The `armmanagementpartner` module provides operations for working with Azure Man ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Management Partner 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 -client := armmanagementpartner.(, cred, nil) +client, err := armmanagementpartner.(, cred, nil) ``` 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 -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armmanagementpartner.(, cred, &options) +client, err := armmanagementpartner.(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/autorest.md b/sdk/resourcemanager/managementpartner/armmanagementpartner/autorest.md index 156e4cf7b3b7..6b9cb4ea864e 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/autorest.md +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/dc439efcfc15448824877603f66fc1578d1c71c5/specification/managementpartner/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/dc439efcfc15448824877603f66fc1578d1c71c5/specification/managementpartner/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/managementpartner/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/managementpartner/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/go.mod b/sdk/resourcemanager/managementpartner/armmanagementpartner/go.mod index 775670a5e1cd..86f9cd775f40 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/go.mod +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementpartner/armmanagementpartner -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/go.sum b/sdk/resourcemanager/managementpartner/armmanagementpartner/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/go.sum +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm 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/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/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-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/ze_generated_example_operation_client_test.go b/sdk/resourcemanager/managementpartner/armmanagementpartner/ze_generated_example_operation_client_test.go index dbe7adc21866..97f0ad8a88c8 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/ze_generated_example_operation_client_test.go +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/ze_generated_example_operation_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,25 +16,29 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementpartner/armmanagementpartner" ) -// x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetOperations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetOperations.json func ExampleOperationClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementpartner.NewOperationClient(cred, nil) + client, err := armmanagementpartner.NewOperationClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/ze_generated_example_partner_client_test.go b/sdk/resourcemanager/managementpartner/armmanagementpartner/ze_generated_example_partner_client_test.go index f8f8b8bfde99..3f7c70f2220a 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/ze_generated_example_partner_client_test.go +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/ze_generated_example_partner_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,69 +16,96 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementpartner/armmanagementpartner" ) -// x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetails.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetails.json func ExamplePartnerClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementpartner.NewPartnerClient(cred, nil) + client, err := armmanagementpartner.NewPartnerClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PartnerClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PutPartnerDetails.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PutPartnerDetails.json func ExamplePartnerClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementpartner.NewPartnerClient(cred, nil) + client, err := armmanagementpartner.NewPartnerClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Create(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PartnerClientCreateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PatchPartnerDetails.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PatchPartnerDetails.json func ExamplePartnerClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementpartner.NewPartnerClient(cred, nil) + client, err := armmanagementpartner.NewPartnerClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PartnerClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/DeletePartnerDetails.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/DeletePartnerDetails.json func ExamplePartnerClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementpartner.NewPartnerClient(cred, nil) + client, err := armmanagementpartner.NewPartnerClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/ze_generated_example_partners_client_test.go b/sdk/resourcemanager/managementpartner/armmanagementpartner/ze_generated_example_partners_client_test.go index b1e7018245d1..3d93b0fee5dc 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/ze_generated_example_partners_client_test.go +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/ze_generated_example_partners_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,18 +16,25 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementpartner/armmanagementpartner" ) -// x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetailsNoPartnerId.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetailsNoPartnerId.json func ExamplePartnersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmanagementpartner.NewPartnersClient(cred, nil) + client, err := armmanagementpartner.NewPartnersClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PartnersClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_constants.go b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_constants.go index 47207279fcea..45941fc9278f 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_constants.go +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armmanagementpartner const ( moduleName = "armmanagementpartner" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // ManagementPartnerState - this is the management partner state: Active or Deleted @@ -28,8 +28,3 @@ func PossibleManagementPartnerStateValues() []ManagementPartnerState { ManagementPartnerStateDeleted, } } - -// ToPtr returns a *ManagementPartnerState pointing to the current value. -func (c ManagementPartnerState) ToPtr() *ManagementPartnerState { - return &c -} diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_models.go b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_models.go index 0b2ce4d012e3..dbb86b8e6f6d 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_models.go +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armmanagementpartner -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // Error - this is the management partner operations error type Error struct { @@ -65,14 +60,6 @@ type OperationList struct { Value []*OperationResponse `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OperationList. -func (o OperationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationResponse - this is the management partner operations response type OperationResponse struct { // this is the operation display @@ -132,61 +119,6 @@ type PartnerProperties struct { Version *int32 `json:"version,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PartnerProperties. -func (p PartnerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdTime", p.CreatedTime) - populate(objectMap, "objectId", p.ObjectID) - populate(objectMap, "partnerId", p.PartnerID) - populate(objectMap, "partnerName", p.PartnerName) - populate(objectMap, "state", p.State) - populate(objectMap, "tenantId", p.TenantID) - populateTimeRFC3339(objectMap, "updatedTime", p.UpdatedTime) - populate(objectMap, "version", p.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerProperties. -func (p *PartnerProperties) 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 "createdTime": - err = unpopulateTimeRFC3339(val, &p.CreatedTime) - delete(rawMsg, key) - case "objectId": - err = unpopulate(val, &p.ObjectID) - delete(rawMsg, key) - case "partnerId": - err = unpopulate(val, &p.PartnerID) - delete(rawMsg, key) - case "partnerName": - err = unpopulate(val, &p.PartnerName) - delete(rawMsg, key) - case "state": - err = unpopulate(val, &p.State) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, &p.TenantID) - delete(rawMsg, key) - case "updatedTime": - err = unpopulateTimeRFC3339(val, &p.UpdatedTime) - delete(rawMsg, key) - case "version": - err = unpopulate(val, &p.Version) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // PartnerResponse - this is the management partner operations response type PartnerResponse struct { // Type of the partner @@ -209,20 +141,3 @@ type PartnerResponse struct { type PartnersClientGetOptions struct { // placeholder for future optional parameters } - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_models_serde.go b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_models_serde.go new file mode 100644 index 000000000000..0dbfa0196878 --- /dev/null +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_models_serde.go @@ -0,0 +1,95 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmanagementpartner + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type OperationList. +func (o OperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PartnerProperties. +func (p PartnerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdTime", p.CreatedTime) + populate(objectMap, "objectId", p.ObjectID) + populate(objectMap, "partnerId", p.PartnerID) + populate(objectMap, "partnerName", p.PartnerName) + populate(objectMap, "state", p.State) + populate(objectMap, "tenantId", p.TenantID) + populateTimeRFC3339(objectMap, "updatedTime", p.UpdatedTime) + populate(objectMap, "version", p.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerProperties. +func (p *PartnerProperties) 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 "createdTime": + err = unpopulateTimeRFC3339(val, &p.CreatedTime) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, &p.ObjectID) + delete(rawMsg, key) + case "partnerId": + err = unpopulate(val, &p.PartnerID) + delete(rawMsg, key) + case "partnerName": + err = unpopulate(val, &p.PartnerName) + delete(rawMsg, key) + case "state": + err = unpopulate(val, &p.State) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, &p.TenantID) + delete(rawMsg, key) + case "updatedTime": + err = unpopulateTimeRFC3339(val, &p.UpdatedTime) + delete(rawMsg, key) + case "version": + err = unpopulate(val, &p.Version) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_operation_client.go b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_operation_client.go index 2ac61bc1d1ae..42597a2486d0 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_operation_client.go +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_operation_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,34 +29,54 @@ type OperationClient struct { // NewOperationClient creates a new instance of OperationClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - List all the operations. // If the operation fails it returns an *azcore.ResponseError type. // options - OperationClientListOptions contains the optional parameters for the OperationClient.List method. -func (client *OperationClient) List(options *OperationClientListOptions) *OperationClientListPager { - return &OperationClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *OperationClient) List(options *OperationClientListOptions) *runtime.Pager[OperationClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[OperationClientListResponse]{ + More: func(page OperationClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp OperationClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationList.NextLink) + Fetcher: func(ctx context.Context, page *OperationClientListResponse) (OperationClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -74,7 +95,7 @@ func (client *OperationClient) listCreateRequest(ctx context.Context, options *O // listHandleResponse handles the List response. func (client *OperationClient) listHandleResponse(resp *http.Response) (OperationClientListResponse, error) { - result := OperationClientListResponse{RawResponse: resp} + result := OperationClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationList); err != nil { return OperationClientListResponse{}, err } diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_pagers.go b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_pagers.go deleted file mode 100644 index 401953037bbe..000000000000 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_pagers.go +++ /dev/null @@ -1,71 +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 armmanagementpartner - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// OperationClientListPager provides operations for iterating over paged responses. -type OperationClientListPager struct { - client *OperationClient - current OperationClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, OperationClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *OperationClientListPager) 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 *OperationClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.OperationList.NextLink == nil || len(*p.current.OperationList.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 = runtime.NewResponseError(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 OperationClientListResponse page. -func (p *OperationClientListPager) PageResponse() OperationClientListResponse { - return p.current -} diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_partner_client.go b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_partner_client.go index c9dad21ed58c..d2547561e296 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_partner_client.go +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_partner_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -31,19 +32,23 @@ type PartnerClient struct { // NewPartnerClient creates a new instance of PartnerClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPartnerClient(credential azcore.TokenCredential, options *arm.ClientOptions) *PartnerClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPartnerClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PartnerClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PartnerClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Create - Create a management partner for the objectId and tenantId. @@ -85,7 +90,7 @@ func (client *PartnerClient) createCreateRequest(ctx context.Context, partnerID // createHandleResponse handles the Create response. func (client *PartnerClient) createHandleResponse(resp *http.Response) (PartnerClientCreateResponse, error) { - result := PartnerClientCreateResponse{RawResponse: resp} + result := PartnerClientCreateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PartnerResponse); err != nil { return PartnerClientCreateResponse{}, err } @@ -108,7 +113,7 @@ func (client *PartnerClient) Delete(ctx context.Context, partnerID string, optio if !runtime.HasStatusCode(resp, http.StatusOK) { return PartnerClientDeleteResponse{}, runtime.NewResponseError(resp) } - return PartnerClientDeleteResponse{RawResponse: resp}, nil + return PartnerClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -168,7 +173,7 @@ func (client *PartnerClient) getCreateRequest(ctx context.Context, partnerID str // getHandleResponse handles the Get response. func (client *PartnerClient) getHandleResponse(resp *http.Response) (PartnerClientGetResponse, error) { - result := PartnerClientGetResponse{RawResponse: resp} + result := PartnerClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PartnerResponse); err != nil { return PartnerClientGetResponse{}, err } @@ -214,7 +219,7 @@ func (client *PartnerClient) updateCreateRequest(ctx context.Context, partnerID // updateHandleResponse handles the Update response. func (client *PartnerClient) updateHandleResponse(resp *http.Response) (PartnerClientUpdateResponse, error) { - result := PartnerClientUpdateResponse{RawResponse: resp} + result := PartnerClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PartnerResponse); err != nil { return PartnerClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_partners_client.go b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_partners_client.go index 548bcc95094a..0f546f6502b7 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_partners_client.go +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_partners_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,19 +29,23 @@ type PartnersClient struct { // NewPartnersClient creates a new instance of PartnersClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPartnersClient(credential azcore.TokenCredential, options *arm.ClientOptions) *PartnersClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPartnersClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PartnersClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PartnersClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get the management partner using the objectId and tenantId. @@ -77,7 +82,7 @@ func (client *PartnersClient) getCreateRequest(ctx context.Context, options *Par // getHandleResponse handles the Get response. func (client *PartnersClient) getHandleResponse(resp *http.Response) (PartnersClientGetResponse, error) { - result := PartnersClientGetResponse{RawResponse: resp} + result := PartnersClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PartnerResponse); err != nil { return PartnersClientGetResponse{}, err } diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_response_types.go b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_response_types.go index 93ef1494d922..68b25ee6bf12 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_response_types.go +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,70 +8,32 @@ package armmanagementpartner -import "net/http" - // OperationClientListResponse contains the response from method OperationClient.List. type OperationClientListResponse struct { - OperationClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationClientListResult contains the result from method OperationClient.List. -type OperationClientListResult struct { OperationList } // PartnerClientCreateResponse contains the response from method PartnerClient.Create. type PartnerClientCreateResponse struct { - PartnerClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerClientCreateResult contains the result from method PartnerClient.Create. -type PartnerClientCreateResult struct { PartnerResponse } // PartnerClientDeleteResponse contains the response from method PartnerClient.Delete. type PartnerClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PartnerClientGetResponse contains the response from method PartnerClient.Get. type PartnerClientGetResponse struct { - PartnerClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerClientGetResult contains the result from method PartnerClient.Get. -type PartnerClientGetResult struct { PartnerResponse } // PartnerClientUpdateResponse contains the response from method PartnerClient.Update. type PartnerClientUpdateResponse struct { - PartnerClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerClientUpdateResult contains the result from method PartnerClient.Update. -type PartnerClientUpdateResult struct { PartnerResponse } // PartnersClientGetResponse contains the response from method PartnersClient.Get. type PartnersClientGetResponse struct { - PartnersClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnersClientGetResult contains the result from method PartnersClient.Get. -type PartnersClientGetResult struct { PartnerResponse } diff --git a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_time_rfc3339.go b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_time_rfc3339.go index f4b1b1e8f3e9..1fd623cdd173 100644 --- a/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/managementpartner/armmanagementpartner/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/maps/armmaps/CHANGELOG.md b/sdk/resourcemanager/maps/armmaps/CHANGELOG.md index 1e363d472090..8f3171b0842b 100644 --- a/sdk/resourcemanager/maps/armmaps/CHANGELOG.md +++ b/sdk/resourcemanager/maps/armmaps/CHANGELOG.md @@ -1,5 +1,106 @@ # Release History +## 0.3.0 (2022-04-12) +### Breaking Changes + +- Function `*AccountsClient.ListByResourceGroup` return value(s) have been changed from `(*AccountsClientListByResourceGroupPager)` to `(*runtime.Pager[AccountsClientListByResourceGroupResponse])` +- Function `*Client.ListSubscriptionOperations` return value(s) have been changed from `(*ClientListSubscriptionOperationsPager)` to `(*runtime.Pager[ClientListSubscriptionOperationsResponse])` +- Function `NewAccountsClient` return value(s) have been changed from `(*AccountsClient)` to `(*AccountsClient, error)` +- Function `NewCreatorsClient` return value(s) have been changed from `(*CreatorsClient)` to `(*CreatorsClient, error)` +- Function `NewClient` return value(s) have been changed from `(*Client)` to `(*Client, error)` +- Function `*AccountsClient.ListBySubscription` return value(s) have been changed from `(*AccountsClientListBySubscriptionPager)` to `(*runtime.Pager[AccountsClientListBySubscriptionResponse])` +- Function `*CreatorsClient.ListByAccount` return value(s) have been changed from `(*CreatorsClientListByAccountPager)` to `(*runtime.Pager[CreatorsClientListByAccountResponse])` +- Function `*Client.ListOperations` return value(s) have been changed from `(*ClientListOperationsPager)` to `(*runtime.Pager[ClientListOperationsResponse])` +- Type of `ErrorAdditionalInfo.Info` has been changed from `map[string]interface{}` to `interface{}` +- Function `*CreatorsClientListByAccountPager.Err` has been removed +- Function `*ClientListOperationsPager.NextPage` has been removed +- Function `*ClientListOperationsPager.Err` has been removed +- Function `SigningKey.ToPtr` has been removed +- Function `ResourceIdentityType.ToPtr` has been removed +- Function `*AccountsClientListBySubscriptionPager.PageResponse` has been removed +- Function `*AccountsClientListBySubscriptionPager.NextPage` has been removed +- Function `Name.ToPtr` has been removed +- Function `*AccountsClientListByResourceGroupPager.Err` has been removed +- Function `CreatedByType.ToPtr` has been removed +- Function `*AccountsClientListBySubscriptionPager.Err` has been removed +- Function `*AccountsClientListByResourceGroupPager.NextPage` has been removed +- Function `KeyType.ToPtr` has been removed +- Function `*AccountsClientListByResourceGroupPager.PageResponse` has been removed +- Function `*ClientListSubscriptionOperationsPager.PageResponse` has been removed +- Function `*CreatorsClientListByAccountPager.PageResponse` has been removed +- Function `Kind.ToPtr` has been removed +- Function `*ClientListSubscriptionOperationsPager.Err` has been removed +- Function `*ClientListSubscriptionOperationsPager.NextPage` has been removed +- Function `*ClientListOperationsPager.PageResponse` has been removed +- Function `*CreatorsClientListByAccountPager.NextPage` has been removed +- Struct `AccountsClientCreateOrUpdateResult` has been removed +- Struct `AccountsClientGetResult` has been removed +- Struct `AccountsClientListByResourceGroupPager` has been removed +- Struct `AccountsClientListByResourceGroupResult` has been removed +- Struct `AccountsClientListBySubscriptionPager` has been removed +- Struct `AccountsClientListBySubscriptionResult` has been removed +- Struct `AccountsClientListKeysResult` has been removed +- Struct `AccountsClientListSasResult` has been removed +- Struct `AccountsClientRegenerateKeysResult` has been removed +- Struct `AccountsClientUpdateResult` has been removed +- Struct `ClientListOperationsPager` has been removed +- Struct `ClientListOperationsResult` has been removed +- Struct `ClientListSubscriptionOperationsPager` has been removed +- Struct `ClientListSubscriptionOperationsResult` has been removed +- Struct `CreatorsClientCreateOrUpdateResult` has been removed +- Struct `CreatorsClientGetResult` has been removed +- Struct `CreatorsClientListByAccountPager` has been removed +- Struct `CreatorsClientListByAccountResult` has been removed +- Struct `CreatorsClientUpdateResult` has been removed +- Field `AccountsClientGetResult` of struct `AccountsClientGetResponse` has been removed +- Field `RawResponse` of struct `AccountsClientGetResponse` has been removed +- Field `AccountsClientUpdateResult` of struct `AccountsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `AccountsClientUpdateResponse` has been removed +- Field `AccountsClientListBySubscriptionResult` of struct `AccountsClientListBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `AccountsClientListBySubscriptionResponse` has been removed +- Field `AccountsClientRegenerateKeysResult` of struct `AccountsClientRegenerateKeysResponse` has been removed +- Field `RawResponse` of struct `AccountsClientRegenerateKeysResponse` has been removed +- Field `CreatorsClientGetResult` of struct `CreatorsClientGetResponse` has been removed +- Field `RawResponse` of struct `CreatorsClientGetResponse` has been removed +- Field `CreatorsClientUpdateResult` of struct `CreatorsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `CreatorsClientUpdateResponse` has been removed +- Field `AccountsClientCreateOrUpdateResult` of struct `AccountsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `AccountsClientCreateOrUpdateResponse` has been removed +- Field `CreatorsClientCreateOrUpdateResult` of struct `CreatorsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `CreatorsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `CreatorsClientDeleteResponse` has been removed +- Field `CreatorsClientListByAccountResult` of struct `CreatorsClientListByAccountResponse` has been removed +- Field `RawResponse` of struct `CreatorsClientListByAccountResponse` has been removed +- Field `AccountsClientListSasResult` of struct `AccountsClientListSasResponse` has been removed +- Field `RawResponse` of struct `AccountsClientListSasResponse` has been removed +- Field `AccountsClientListKeysResult` of struct `AccountsClientListKeysResponse` has been removed +- Field `RawResponse` of struct `AccountsClientListKeysResponse` has been removed +- Field `AccountsClientListByResourceGroupResult` of struct `AccountsClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `AccountsClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `AccountsClientDeleteResponse` has been removed +- Field `ClientListSubscriptionOperationsResult` of struct `ClientListSubscriptionOperationsResponse` has been removed +- Field `RawResponse` of struct `ClientListSubscriptionOperationsResponse` has been removed +- Field `ClientListOperationsResult` of struct `ClientListOperationsResponse` has been removed +- Field `RawResponse` of struct `ClientListOperationsResponse` has been removed + +### Features Added + +- New anonymous field `Accounts` in struct `AccountsClientListByResourceGroupResponse` +- New anonymous field `Accounts` in struct `AccountsClientListBySubscriptionResponse` +- New anonymous field `Creator` in struct `CreatorsClientUpdateResponse` +- New anonymous field `Account` in struct `AccountsClientUpdateResponse` +- New anonymous field `CreatorList` in struct `CreatorsClientListByAccountResponse` +- New anonymous field `Operations` in struct `ClientListSubscriptionOperationsResponse` +- New anonymous field `Operations` in struct `ClientListOperationsResponse` +- New anonymous field `Creator` in struct `CreatorsClientGetResponse` +- New anonymous field `Account` in struct `AccountsClientGetResponse` +- New anonymous field `AccountKeys` in struct `AccountsClientRegenerateKeysResponse` +- New anonymous field `AccountSasToken` in struct `AccountsClientListSasResponse` +- New anonymous field `Creator` in struct `CreatorsClientCreateOrUpdateResponse` +- New anonymous field `AccountKeys` in struct `AccountsClientListKeysResponse` +- New anonymous field `Account` in struct `AccountsClientCreateOrUpdateResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/maps/armmaps/README.md b/sdk/resourcemanager/maps/armmaps/README.md index 6ab918a649b9..4bd92eec4fff 100644 --- a/sdk/resourcemanager/maps/armmaps/README.md +++ b/sdk/resourcemanager/maps/armmaps/README.md @@ -11,7 +11,7 @@ The `armmaps` module provides operations for working with Azure Maps. ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Maps 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 -client := armmaps.NewCreatorsClient(, cred, nil) +client, err := armmaps.NewCreatorsClient(, cred, nil) ``` 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 -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armmaps.NewCreatorsClient(, cred, &options) +client, err := armmaps.NewCreatorsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/maps/armmaps/autorest.md b/sdk/resourcemanager/maps/armmaps/autorest.md index 9db4fa3133c5..e87f297ca289 100644 --- a/sdk/resourcemanager/maps/armmaps/autorest.md +++ b/sdk/resourcemanager/maps/armmaps/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/maps/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/maps/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/maps/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/maps/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/maps/armmaps/go.mod b/sdk/resourcemanager/maps/armmaps/go.mod index cf69346c6794..70f25ea2c7e3 100644 --- a/sdk/resourcemanager/maps/armmaps/go.mod +++ b/sdk/resourcemanager/maps/armmaps/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maps/armmaps -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/maps/armmaps/go.sum b/sdk/resourcemanager/maps/armmaps/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/maps/armmaps/go.sum +++ b/sdk/resourcemanager/maps/armmaps/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm 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/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/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-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/maps/armmaps/ze_generated_example_accounts_client_test.go b/sdk/resourcemanager/maps/armmaps/ze_generated_example_accounts_client_test.go index 4f9a55f72ac0..74317289a518 100644 --- a/sdk/resourcemanager/maps/armmaps/ze_generated_example_accounts_client_test.go +++ b/sdk/resourcemanager/maps/armmaps/ze_generated_example_accounts_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,233 +17,289 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maps/armmaps" ) -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/CreateAccountManagedIdentity.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/CreateAccountManagedIdentity.json func ExampleAccountsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewAccountsClient("", cred, nil) + client, err := armmaps.NewAccountsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", armmaps.Account{ - Location: to.StringPtr(""), + Location: to.Ptr(""), Tags: map[string]*string{ - "test": to.StringPtr("true"), + "test": to.Ptr("true"), }, Identity: &armmaps.ManagedServiceIdentity{ - Type: armmaps.ResourceIdentityTypeSystemAssignedUserAssigned.ToPtr(), + Type: to.Ptr(armmaps.ResourceIdentityTypeSystemAssignedUserAssigned), UserAssignedIdentities: map[string]*armmaps.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName": {}, }, }, - Kind: armmaps.Kind("Gen2").ToPtr(), + Kind: to.Ptr(armmaps.KindGen2), Properties: &armmaps.AccountProperties{ - DisableLocalAuth: to.BoolPtr(false), + DisableLocalAuth: to.Ptr(false), LinkedResources: []*armmaps.LinkedResource{ { - ID: to.StringPtr(""), - UniqueName: to.StringPtr(""), + ID: to.Ptr(""), + UniqueName: to.Ptr(""), }, { - ID: to.StringPtr(""), - UniqueName: to.StringPtr(""), + ID: to.Ptr(""), + UniqueName: to.Ptr(""), }}, }, SKU: &armmaps.SKU{ - Name: armmaps.Name("G2").ToPtr(), + Name: to.Ptr(armmaps.NameG2), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/UpdateAccountManagedIdentity.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/UpdateAccountManagedIdentity.json func ExampleAccountsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewAccountsClient("", cred, nil) + client, err := armmaps.NewAccountsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", armmaps.AccountUpdateParameters{ Identity: &armmaps.ManagedServiceIdentity{ - Type: armmaps.ResourceIdentityTypeSystemAssignedUserAssigned.ToPtr(), + Type: to.Ptr(armmaps.ResourceIdentityTypeSystemAssignedUserAssigned), UserAssignedIdentities: map[string]*armmaps.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName": {}, }, }, - Kind: armmaps.Kind("Gen2").ToPtr(), + Kind: to.Ptr(armmaps.KindGen2), Properties: &armmaps.AccountProperties{ LinkedResources: []*armmaps.LinkedResource{ { - ID: to.StringPtr(""), - UniqueName: to.StringPtr(""), + ID: to.Ptr(""), + UniqueName: to.Ptr(""), }}, }, SKU: &armmaps.SKU{ - Name: armmaps.Name("G2").ToPtr(), + Name: to.Ptr(armmaps.NameG2), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountsClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/DeleteAccount.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/DeleteAccount.json func ExampleAccountsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewAccountsClient("", cred, nil) + client, err := armmaps.NewAccountsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/GetAccount.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/GetAccount.json func ExampleAccountsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewAccountsClient("", cred, nil) + client, err := armmaps.NewAccountsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/ListAccountsByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/ListAccountsByResourceGroup.json func ExampleAccountsClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewAccountsClient("", cred, nil) + client, err := armmaps.NewAccountsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByResourceGroup("", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/ListAccountsBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/ListAccountsBySubscription.json func ExampleAccountsClient_ListBySubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewAccountsClient("", cred, nil) + client, err := armmaps.NewAccountsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListBySubscription(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/AccountListSAS.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/AccountListSAS.json func ExampleAccountsClient_ListSas() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewAccountsClient("", cred, nil) + client, err := armmaps.NewAccountsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListSas(ctx, "", "", armmaps.AccountSasParameters{ - Expiry: to.StringPtr(""), - MaxRatePerSecond: to.Int32Ptr(500), - PrincipalID: to.StringPtr(""), + Expiry: to.Ptr(""), + MaxRatePerSecond: to.Ptr[int32](500), + PrincipalID: to.Ptr(""), Regions: []*string{ - to.StringPtr("eastus")}, - SigningKey: armmaps.SigningKey("primaryKey").ToPtr(), - Start: to.StringPtr(""), + to.Ptr("eastus")}, + SigningKey: to.Ptr(armmaps.SigningKeyPrimaryKey), + Start: to.Ptr(""), }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountsClientListSasResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/ListKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/ListKeys.json func ExampleAccountsClient_ListKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewAccountsClient("", cred, nil) + client, err := armmaps.NewAccountsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListKeys(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountsClientListKeysResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/RegenerateKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/RegenerateKey.json func ExampleAccountsClient_RegenerateKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewAccountsClient("", cred, nil) + client, err := armmaps.NewAccountsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.RegenerateKeys(ctx, "", "", armmaps.KeySpecification{ - KeyType: armmaps.KeyType("primary").ToPtr(), + KeyType: to.Ptr(armmaps.KeyTypePrimary), }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountsClientRegenerateKeysResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/maps/armmaps/ze_generated_example_creators_client_test.go b/sdk/resourcemanager/maps/armmaps/ze_generated_example_creators_client_test.go index a95a80712c3d..d223a03ba21b 100644 --- a/sdk/resourcemanager/maps/armmaps/ze_generated_example_creators_client_test.go +++ b/sdk/resourcemanager/maps/armmaps/ze_generated_example_creators_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,119 +17,150 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maps/armmaps" ) -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/ListMapsCreatorsByAccount.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/ListMapsCreatorsByAccount.json func ExampleCreatorsClient_ListByAccount() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewCreatorsClient("", cred, nil) + client, err := armmaps.NewCreatorsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByAccount("", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/CreateMapsCreator.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/CreateMapsCreator.json func ExampleCreatorsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewCreatorsClient("", cred, nil) + client, err := armmaps.NewCreatorsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", "", armmaps.Creator{ - Location: to.StringPtr(""), + Location: to.Ptr(""), Tags: map[string]*string{ - "test": to.StringPtr("true"), + "test": to.Ptr("true"), }, Properties: &armmaps.CreatorProperties{ - StorageUnits: to.Int32Ptr(5), + StorageUnits: to.Ptr[int32](5), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.CreatorsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/UpdateMapsCreator.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/UpdateMapsCreator.json func ExampleCreatorsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewCreatorsClient("", cred, nil) + client, err := armmaps.NewCreatorsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", "", armmaps.CreatorUpdateParameters{ Properties: &armmaps.CreatorProperties{ - StorageUnits: to.Int32Ptr(10), + StorageUnits: to.Ptr[int32](10), }, Tags: map[string]*string{ - "specialTag": to.StringPtr("true"), + "specialTag": to.Ptr("true"), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.CreatorsClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/DeleteMapsCreator.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/DeleteMapsCreator.json func ExampleCreatorsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewCreatorsClient("", cred, nil) + client, err := armmaps.NewCreatorsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/GetMapsCreator.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/GetMapsCreator.json func ExampleCreatorsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewCreatorsClient("", cred, nil) + client, err := armmaps.NewCreatorsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.CreatorsClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/maps/armmaps/ze_generated_example_maps_client_test.go b/sdk/resourcemanager/maps/armmaps/ze_generated_example_maps_client_test.go index c3d73df82794..867999cedc0b 100644 --- a/sdk/resourcemanager/maps/armmaps/ze_generated_example_maps_client_test.go +++ b/sdk/resourcemanager/maps/armmaps/ze_generated_example_maps_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,48 +16,56 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maps/armmaps" ) -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/GetOperations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/GetOperations.json func ExampleClient_ListOperations() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewClient("", cred, nil) + client, err := armmaps.NewClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListOperations(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/GetOperationsSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/GetOperationsSubscription.json func ExampleClient_ListSubscriptionOperations() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmaps.NewClient("", cred, nil) + client, err := armmaps.NewClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListSubscriptionOperations(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/maps/armmaps/zz_generated_accounts_client.go b/sdk/resourcemanager/maps/armmaps/zz_generated_accounts_client.go index 45a486c719a1..c58ba32384a2 100644 --- a/sdk/resourcemanager/maps/armmaps/zz_generated_accounts_client.go +++ b/sdk/resourcemanager/maps/armmaps/zz_generated_accounts_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type AccountsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccountsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &AccountsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Create or update a Maps Account. A Maps Account holds the keys which allow access to the Maps REST APIs. @@ -98,7 +103,7 @@ func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, r // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *AccountsClient) createOrUpdateHandleResponse(resp *http.Response) (AccountsClientCreateOrUpdateResponse, error) { - result := AccountsClientCreateOrUpdateResponse{RawResponse: resp} + result := AccountsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Account); err != nil { return AccountsClientCreateOrUpdateResponse{}, err } @@ -122,7 +127,7 @@ func (client *AccountsClient) Delete(ctx context.Context, resourceGroupName stri if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return AccountsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return AccountsClientDeleteResponse{RawResponse: resp}, nil + return AccountsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -199,7 +204,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou // getHandleResponse handles the Get response. func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsClientGetResponse, error) { - result := AccountsClientGetResponse{RawResponse: resp} + result := AccountsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Account); err != nil { return AccountsClientGetResponse{}, err } @@ -211,16 +216,32 @@ func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsCl // resourceGroupName - The name of the resource group. The name is case insensitive. // options - AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.ListByResourceGroup // method. -func (client *AccountsClient) ListByResourceGroup(resourceGroupName string, options *AccountsClientListByResourceGroupOptions) *AccountsClientListByResourceGroupPager { - return &AccountsClientListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) +func (client *AccountsClient) ListByResourceGroup(resourceGroupName string, options *AccountsClientListByResourceGroupOptions) *runtime.Pager[AccountsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[AccountsClientListByResourceGroupResponse]{ + More: func(page AccountsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp AccountsClientListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.Accounts.NextLink) + Fetcher: func(ctx context.Context, page *AccountsClientListByResourceGroupResponse) (AccountsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccountsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccountsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccountsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) }, - } + }) } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. @@ -247,7 +268,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Response) (AccountsClientListByResourceGroupResponse, error) { - result := AccountsClientListByResourceGroupResponse{RawResponse: resp} + result := AccountsClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Accounts); err != nil { return AccountsClientListByResourceGroupResponse{}, err } @@ -258,16 +279,32 @@ func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Respo // If the operation fails it returns an *azcore.ResponseError type. // options - AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.ListBySubscription // method. -func (client *AccountsClient) ListBySubscription(options *AccountsClientListBySubscriptionOptions) *AccountsClientListBySubscriptionPager { - return &AccountsClientListBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) +func (client *AccountsClient) ListBySubscription(options *AccountsClientListBySubscriptionOptions) *runtime.Pager[AccountsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[AccountsClientListBySubscriptionResponse]{ + More: func(page AccountsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp AccountsClientListBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.Accounts.NextLink) + Fetcher: func(ctx context.Context, page *AccountsClientListBySubscriptionResponse) (AccountsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccountsClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccountsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccountsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) }, - } + }) } // listBySubscriptionCreateRequest creates the ListBySubscription request. @@ -290,7 +327,7 @@ func (client *AccountsClient) listBySubscriptionCreateRequest(ctx context.Contex // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *AccountsClient) listBySubscriptionHandleResponse(resp *http.Response) (AccountsClientListBySubscriptionResponse, error) { - result := AccountsClientListBySubscriptionResponse{RawResponse: resp} + result := AccountsClientListBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Accounts); err != nil { return AccountsClientListBySubscriptionResponse{}, err } @@ -346,7 +383,7 @@ func (client *AccountsClient) listKeysCreateRequest(ctx context.Context, resourc // listKeysHandleResponse handles the ListKeys response. func (client *AccountsClient) listKeysHandleResponse(resp *http.Response) (AccountsClientListKeysResponse, error) { - result := AccountsClientListKeysResponse{RawResponse: resp} + result := AccountsClientListKeysResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccountKeys); err != nil { return AccountsClientListKeysResponse{}, err } @@ -406,7 +443,7 @@ func (client *AccountsClient) listSasCreateRequest(ctx context.Context, resource // listSasHandleResponse handles the ListSas response. func (client *AccountsClient) listSasHandleResponse(resp *http.Response) (AccountsClientListSasResponse, error) { - result := AccountsClientListSasResponse{RawResponse: resp} + result := AccountsClientListSasResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccountSasToken); err != nil { return AccountsClientListSasResponse{}, err } @@ -463,7 +500,7 @@ func (client *AccountsClient) regenerateKeysCreateRequest(ctx context.Context, r // regenerateKeysHandleResponse handles the RegenerateKeys response. func (client *AccountsClient) regenerateKeysHandleResponse(resp *http.Response) (AccountsClientRegenerateKeysResponse, error) { - result := AccountsClientRegenerateKeysResponse{RawResponse: resp} + result := AccountsClientRegenerateKeysResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccountKeys); err != nil { return AccountsClientRegenerateKeysResponse{}, err } @@ -519,7 +556,7 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG // updateHandleResponse handles the Update response. func (client *AccountsClient) updateHandleResponse(resp *http.Response) (AccountsClientUpdateResponse, error) { - result := AccountsClientUpdateResponse{RawResponse: resp} + result := AccountsClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Account); err != nil { return AccountsClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/maps/armmaps/zz_generated_client.go b/sdk/resourcemanager/maps/armmaps/zz_generated_client.go index 54ec36bcfb7b..248c07399c33 100644 --- a/sdk/resourcemanager/maps/armmaps/zz_generated_client.go +++ b/sdk/resourcemanager/maps/armmaps/zz_generated_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,35 +34,55 @@ type Client struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *Client { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &Client{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // ListOperations - List operations available for the Maps Resource Provider // If the operation fails it returns an *azcore.ResponseError type. // options - ClientListOperationsOptions contains the optional parameters for the Client.ListOperations method. -func (client *Client) ListOperations(options *ClientListOperationsOptions) *ClientListOperationsPager { - return &ClientListOperationsPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listOperationsCreateRequest(ctx, options) +func (client *Client) ListOperations(options *ClientListOperationsOptions) *runtime.Pager[ClientListOperationsResponse] { + return runtime.NewPager(runtime.PageProcessor[ClientListOperationsResponse]{ + More: func(page ClientListOperationsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ClientListOperationsResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.Operations.NextLink) + Fetcher: func(ctx context.Context, page *ClientListOperationsResponse) (ClientListOperationsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listOperationsCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientListOperationsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientListOperationsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListOperationsResponse{}, runtime.NewResponseError(resp) + } + return client.listOperationsHandleResponse(resp) }, - } + }) } // listOperationsCreateRequest creates the ListOperations request. @@ -80,7 +101,7 @@ func (client *Client) listOperationsCreateRequest(ctx context.Context, options * // listOperationsHandleResponse handles the ListOperations response. func (client *Client) listOperationsHandleResponse(resp *http.Response) (ClientListOperationsResponse, error) { - result := ClientListOperationsResponse{RawResponse: resp} + result := ClientListOperationsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Operations); err != nil { return ClientListOperationsResponse{}, err } @@ -91,16 +112,32 @@ func (client *Client) listOperationsHandleResponse(resp *http.Response) (ClientL // If the operation fails it returns an *azcore.ResponseError type. // options - ClientListSubscriptionOperationsOptions contains the optional parameters for the Client.ListSubscriptionOperations // method. -func (client *Client) ListSubscriptionOperations(options *ClientListSubscriptionOperationsOptions) *ClientListSubscriptionOperationsPager { - return &ClientListSubscriptionOperationsPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listSubscriptionOperationsCreateRequest(ctx, options) +func (client *Client) ListSubscriptionOperations(options *ClientListSubscriptionOperationsOptions) *runtime.Pager[ClientListSubscriptionOperationsResponse] { + return runtime.NewPager(runtime.PageProcessor[ClientListSubscriptionOperationsResponse]{ + More: func(page ClientListSubscriptionOperationsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ClientListSubscriptionOperationsResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.Operations.NextLink) + Fetcher: func(ctx context.Context, page *ClientListSubscriptionOperationsResponse) (ClientListSubscriptionOperationsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listSubscriptionOperationsCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientListSubscriptionOperationsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientListSubscriptionOperationsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListSubscriptionOperationsResponse{}, runtime.NewResponseError(resp) + } + return client.listSubscriptionOperationsHandleResponse(resp) }, - } + }) } // listSubscriptionOperationsCreateRequest creates the ListSubscriptionOperations request. @@ -123,7 +160,7 @@ func (client *Client) listSubscriptionOperationsCreateRequest(ctx context.Contex // listSubscriptionOperationsHandleResponse handles the ListSubscriptionOperations response. func (client *Client) listSubscriptionOperationsHandleResponse(resp *http.Response) (ClientListSubscriptionOperationsResponse, error) { - result := ClientListSubscriptionOperationsResponse{RawResponse: resp} + result := ClientListSubscriptionOperationsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Operations); err != nil { return ClientListSubscriptionOperationsResponse{}, err } diff --git a/sdk/resourcemanager/maps/armmaps/zz_generated_constants.go b/sdk/resourcemanager/maps/armmaps/zz_generated_constants.go index 76cbe1e88994..d64eec5505c1 100644 --- a/sdk/resourcemanager/maps/armmaps/zz_generated_constants.go +++ b/sdk/resourcemanager/maps/armmaps/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armmaps const ( moduleName = "armmaps" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // CreatedByType - The type of identity that created the resource. @@ -33,11 +33,6 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// ToPtr returns a *CreatedByType pointing to the current value. -func (c CreatedByType) ToPtr() *CreatedByType { - return &c -} - // KeyType - Whether the operation refers to the primary or secondary key. type KeyType string @@ -54,11 +49,6 @@ func PossibleKeyTypeValues() []KeyType { } } -// ToPtr returns a *KeyType pointing to the current value. -func (c KeyType) ToPtr() *KeyType { - return &c -} - // Kind - The Kind of the Maps Account. type Kind string @@ -75,11 +65,6 @@ func PossibleKindValues() []Kind { } } -// ToPtr returns a *Kind pointing to the current value. -func (c Kind) ToPtr() *Kind { - return &c -} - // Name - The name of the SKU, in standard format (such as S0). type Name string @@ -98,11 +83,6 @@ func PossibleNameValues() []Name { } } -// ToPtr returns a *Name pointing to the current value. -func (c Name) ToPtr() *Name { - return &c -} - // ResourceIdentityType - The identity type. type ResourceIdentityType string @@ -123,11 +103,6 @@ func PossibleResourceIdentityTypeValues() []ResourceIdentityType { } } -// ToPtr returns a *ResourceIdentityType pointing to the current value. -func (c ResourceIdentityType) ToPtr() *ResourceIdentityType { - return &c -} - // SigningKey - The Map account key to use for signing. type SigningKey string @@ -143,8 +118,3 @@ func PossibleSigningKeyValues() []SigningKey { SigningKeySecondaryKey, } } - -// ToPtr returns a *SigningKey pointing to the current value. -func (c SigningKey) ToPtr() *SigningKey { - return &c -} diff --git a/sdk/resourcemanager/maps/armmaps/zz_generated_creators_client.go b/sdk/resourcemanager/maps/armmaps/zz_generated_creators_client.go index a6677a46a031..0eef347ae1ef 100644 --- a/sdk/resourcemanager/maps/armmaps/zz_generated_creators_client.go +++ b/sdk/resourcemanager/maps/armmaps/zz_generated_creators_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type CreatorsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewCreatorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CreatorsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewCreatorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CreatorsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &CreatorsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Create or update a Maps Creator resource. Creator resource will manage Azure resources required to populate @@ -104,7 +109,7 @@ func (client *CreatorsClient) createOrUpdateCreateRequest(ctx context.Context, r // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *CreatorsClient) createOrUpdateHandleResponse(resp *http.Response) (CreatorsClientCreateOrUpdateResponse, error) { - result := CreatorsClientCreateOrUpdateResponse{RawResponse: resp} + result := CreatorsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Creator); err != nil { return CreatorsClientCreateOrUpdateResponse{}, err } @@ -129,7 +134,7 @@ func (client *CreatorsClient) Delete(ctx context.Context, resourceGroupName stri if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return CreatorsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return CreatorsClientDeleteResponse{RawResponse: resp}, nil + return CreatorsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -215,7 +220,7 @@ func (client *CreatorsClient) getCreateRequest(ctx context.Context, resourceGrou // getHandleResponse handles the Get response. func (client *CreatorsClient) getHandleResponse(resp *http.Response) (CreatorsClientGetResponse, error) { - result := CreatorsClientGetResponse{RawResponse: resp} + result := CreatorsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Creator); err != nil { return CreatorsClientGetResponse{}, err } @@ -227,16 +232,32 @@ func (client *CreatorsClient) getHandleResponse(resp *http.Response) (CreatorsCl // resourceGroupName - The name of the resource group. The name is case insensitive. // accountName - The name of the Maps Account. // options - CreatorsClientListByAccountOptions contains the optional parameters for the CreatorsClient.ListByAccount method. -func (client *CreatorsClient) ListByAccount(resourceGroupName string, accountName string, options *CreatorsClientListByAccountOptions) *CreatorsClientListByAccountPager { - return &CreatorsClientListByAccountPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByAccountCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *CreatorsClient) ListByAccount(resourceGroupName string, accountName string, options *CreatorsClientListByAccountOptions) *runtime.Pager[CreatorsClientListByAccountResponse] { + return runtime.NewPager(runtime.PageProcessor[CreatorsClientListByAccountResponse]{ + More: func(page CreatorsClientListByAccountResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp CreatorsClientListByAccountResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.CreatorList.NextLink) + Fetcher: func(ctx context.Context, page *CreatorsClientListByAccountResponse) (CreatorsClientListByAccountResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByAccountCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CreatorsClientListByAccountResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CreatorsClientListByAccountResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CreatorsClientListByAccountResponse{}, runtime.NewResponseError(resp) + } + return client.listByAccountHandleResponse(resp) }, - } + }) } // listByAccountCreateRequest creates the ListByAccount request. @@ -267,7 +288,7 @@ func (client *CreatorsClient) listByAccountCreateRequest(ctx context.Context, re // listByAccountHandleResponse handles the ListByAccount response. func (client *CreatorsClient) listByAccountHandleResponse(resp *http.Response) (CreatorsClientListByAccountResponse, error) { - result := CreatorsClientListByAccountResponse{RawResponse: resp} + result := CreatorsClientListByAccountResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.CreatorList); err != nil { return CreatorsClientListByAccountResponse{}, err } @@ -328,7 +349,7 @@ func (client *CreatorsClient) updateCreateRequest(ctx context.Context, resourceG // updateHandleResponse handles the Update response. func (client *CreatorsClient) updateHandleResponse(resp *http.Response) (CreatorsClientUpdateResponse, error) { - result := CreatorsClientUpdateResponse{RawResponse: resp} + result := CreatorsClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Creator); err != nil { return CreatorsClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/maps/armmaps/zz_generated_models.go b/sdk/resourcemanager/maps/armmaps/zz_generated_models.go index b49277c3397a..74068befe114 100644 --- a/sdk/resourcemanager/maps/armmaps/zz_generated_models.go +++ b/sdk/resourcemanager/maps/armmaps/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armmaps -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // Account - An Azure resource which represents access to a suite of Maps REST APIs. type Account struct { @@ -48,22 +43,6 @@ type Account struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Account. -func (a Account) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "identity", a.Identity) - populate(objectMap, "kind", a.Kind) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "sku", a.SKU) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - // AccountKeys - The set of keys which can be used to access the Maps REST APIs. Two keys are provided for key rotation without // interruption. type AccountKeys struct { @@ -101,17 +80,6 @@ type AccountProperties struct { UniqueID *string `json:"uniqueId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AccountProperties. -func (a AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "cors", a.Cors) - populate(objectMap, "disableLocalAuth", a.DisableLocalAuth) - populate(objectMap, "linkedResources", a.LinkedResources) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "uniqueId", a.UniqueID) - return json.Marshal(objectMap) -} - // AccountSasParameters - Parameters used to create an account Shared Access Signature (SAS) token. The REST API access control // is provided by Azure Maps Role Based Access (RBAC) identity and access. type AccountSasParameters struct { @@ -140,18 +108,6 @@ type AccountSasParameters struct { Regions []*string `json:"regions,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AccountSasParameters. -func (a AccountSasParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "expiry", a.Expiry) - populate(objectMap, "maxRatePerSecond", a.MaxRatePerSecond) - populate(objectMap, "principalId", a.PrincipalID) - populate(objectMap, "regions", a.Regions) - populate(objectMap, "signingKey", a.SigningKey) - populate(objectMap, "start", a.Start) - return json.Marshal(objectMap) -} - // AccountSasToken - A new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed // identity permissions on Azure (IAM) Role Based Access Control. type AccountSasToken struct { @@ -179,17 +135,6 @@ type AccountUpdateParameters struct { Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AccountUpdateParameters. -func (a AccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", a.Identity) - populate(objectMap, "kind", a.Kind) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "sku", a.SKU) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - // Accounts - A list of Maps Accounts. type Accounts struct { // URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -199,14 +144,6 @@ type Accounts struct { Value []*Account `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Accounts. -func (a Accounts) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - // AccountsClientCreateOrUpdateOptions contains the optional parameters for the AccountsClient.CreateOrUpdate method. type AccountsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -277,26 +214,12 @@ type CorsRule struct { AllowedOrigins []*string `json:"allowedOrigins,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CorsRule. -func (c CorsRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowedOrigins", c.AllowedOrigins) - return json.Marshal(objectMap) -} - // CorsRules - Sets the CORS rules. You can include up to five CorsRule elements in the request. type CorsRules struct { // The list of CORS rules. You can include up to five CorsRule elements in the request. CorsRules []*CorsRule `json:"corsRules,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CorsRules. -func (c CorsRules) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "corsRules", c.CorsRules) - return json.Marshal(objectMap) -} - // Creator - An Azure resource which represents Maps Creator product and provides ability to manage private location data. type Creator struct { // REQUIRED; The geo-location where the resource lives @@ -321,19 +244,6 @@ type Creator struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Creator. -func (c Creator) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - // CreatorList - A list of Creator resources. type CreatorList struct { // URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -343,14 +253,6 @@ type CreatorList struct { Value []*Creator `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type CreatorList. -func (c CreatorList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - // CreatorProperties - Creator resource properties type CreatorProperties struct { // REQUIRED; The storage units to be allocated. Integer values from 1 to 100, inclusive. @@ -371,14 +273,6 @@ type CreatorUpdateParameters struct { Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CreatorUpdateParameters. -func (c CreatorUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "tags", c.Tags) - return json.Marshal(objectMap) -} - // CreatorsClientCreateOrUpdateOptions contains the optional parameters for the CreatorsClient.CreateOrUpdate method. type CreatorsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -428,7 +322,7 @@ type Dimension struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info map[string]interface{} `json:"info,omitempty" azure:"ro"` + Info interface{} `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -452,17 +346,6 @@ type ErrorDetail struct { 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 - Common error response for all Azure Resource Manager APIs to return error details for failed operations. // (This also follows the OData error response format.). type ErrorResponse struct { @@ -503,16 +386,6 @@ type ManagedServiceIdentity struct { TenantID *string `json:"tenantId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. -func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", m.PrincipalID) - populate(objectMap, "tenantId", m.TenantID) - populate(objectMap, "type", m.Type) - populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) - return json.Marshal(objectMap) -} - // MetricSpecification - Metric specification of operation. type MetricSpecification struct { // Aggregation type could be Average. @@ -549,23 +422,6 @@ type MetricSpecification struct { Unit *string `json:"unit,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. -func (m MetricSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregationType", m.AggregationType) - populate(objectMap, "category", m.Category) - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "displayDescription", m.DisplayDescription) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "fillGapWithZero", m.FillGapWithZero) - populate(objectMap, "internalMetricName", m.InternalMetricName) - populate(objectMap, "name", m.Name) - populate(objectMap, "resourceIdDimensionNameOverride", m.ResourceIDDimensionNameOverride) - populate(objectMap, "sourceMdmAccount", m.SourceMdmAccount) - populate(objectMap, "unit", m.Unit) - return json.Marshal(objectMap) -} - // OperationDetail - Operation detail payload type OperationDetail struct { // Display of the operation @@ -614,14 +470,6 @@ type Operations struct { Value []*OperationDetail `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Operations. -func (o Operations) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - 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} @@ -649,13 +497,6 @@ type ServiceSpecification struct { MetricSpecifications []*MetricSpecification `json:"metricSpecifications,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. -func (s ServiceSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "metricSpecifications", s.MetricSpecifications) - return json.Marshal(objectMap) -} - // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -677,53 +518,6 @@ type SystemData struct { 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 -} - // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { @@ -742,31 +536,3 @@ type TrackedResource struct { // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/maps/armmaps/zz_generated_models_serde.go b/sdk/resourcemanager/maps/armmaps/zz_generated_models_serde.go new file mode 100644 index 000000000000..39e46b11d72f --- /dev/null +++ b/sdk/resourcemanager/maps/armmaps/zz_generated_models_serde.go @@ -0,0 +1,244 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmaps + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Account. +func (a Account) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "kind", a.Kind) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "sku", a.SKU) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AccountProperties. +func (a AccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cors", a.Cors) + populate(objectMap, "disableLocalAuth", a.DisableLocalAuth) + populate(objectMap, "linkedResources", a.LinkedResources) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "uniqueId", a.UniqueID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AccountSasParameters. +func (a AccountSasParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "expiry", a.Expiry) + populate(objectMap, "maxRatePerSecond", a.MaxRatePerSecond) + populate(objectMap, "principalId", a.PrincipalID) + populate(objectMap, "regions", a.Regions) + populate(objectMap, "signingKey", a.SigningKey) + populate(objectMap, "start", a.Start) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AccountUpdateParameters. +func (a AccountUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "kind", a.Kind) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "sku", a.SKU) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Accounts. +func (a Accounts) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CorsRule. +func (c CorsRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedOrigins", c.AllowedOrigins) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CorsRules. +func (c CorsRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "corsRules", c.CorsRules) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Creator. +func (c Creator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CreatorList. +func (c CreatorList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CreatorUpdateParameters. +func (c CreatorUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// 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) +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. +func (m MetricSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "category", m.Category) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "fillGapWithZero", m.FillGapWithZero) + populate(objectMap, "internalMetricName", m.InternalMetricName) + populate(objectMap, "name", m.Name) + populate(objectMap, "resourceIdDimensionNameOverride", m.ResourceIDDimensionNameOverride) + populate(objectMap, "sourceMdmAccount", m.SourceMdmAccount) + populate(objectMap, "unit", m.Unit) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Operations. +func (o Operations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. +func (s ServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "metricSpecifications", s.MetricSpecifications) + return json.Marshal(objectMap) +} + +// 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 +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/maps/armmaps/zz_generated_pagers.go b/sdk/resourcemanager/maps/armmaps/zz_generated_pagers.go deleted file mode 100644 index 6d10097cbdf9..000000000000 --- a/sdk/resourcemanager/maps/armmaps/zz_generated_pagers.go +++ /dev/null @@ -1,287 +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 armmaps - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// AccountsClientListByResourceGroupPager provides operations for iterating over paged responses. -type AccountsClientListByResourceGroupPager struct { - client *AccountsClient - current AccountsClientListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, AccountsClientListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *AccountsClientListByResourceGroupPager) 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 *AccountsClientListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.Accounts.NextLink == nil || len(*p.current.Accounts.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 = runtime.NewResponseError(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 AccountsClientListByResourceGroupResponse page. -func (p *AccountsClientListByResourceGroupPager) PageResponse() AccountsClientListByResourceGroupResponse { - return p.current -} - -// AccountsClientListBySubscriptionPager provides operations for iterating over paged responses. -type AccountsClientListBySubscriptionPager struct { - client *AccountsClient - current AccountsClientListBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, AccountsClientListBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *AccountsClientListBySubscriptionPager) 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 *AccountsClientListBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.Accounts.NextLink == nil || len(*p.current.Accounts.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 = runtime.NewResponseError(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 AccountsClientListBySubscriptionResponse page. -func (p *AccountsClientListBySubscriptionPager) PageResponse() AccountsClientListBySubscriptionResponse { - return p.current -} - -// ClientListOperationsPager provides operations for iterating over paged responses. -type ClientListOperationsPager struct { - client *Client - current ClientListOperationsResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ClientListOperationsResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ClientListOperationsPager) 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 *ClientListOperationsPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.Operations.NextLink == nil || len(*p.current.Operations.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listOperationsHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ClientListOperationsResponse page. -func (p *ClientListOperationsPager) PageResponse() ClientListOperationsResponse { - return p.current -} - -// ClientListSubscriptionOperationsPager provides operations for iterating over paged responses. -type ClientListSubscriptionOperationsPager struct { - client *Client - current ClientListSubscriptionOperationsResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ClientListSubscriptionOperationsResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ClientListSubscriptionOperationsPager) 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 *ClientListSubscriptionOperationsPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.Operations.NextLink == nil || len(*p.current.Operations.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listSubscriptionOperationsHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ClientListSubscriptionOperationsResponse page. -func (p *ClientListSubscriptionOperationsPager) PageResponse() ClientListSubscriptionOperationsResponse { - return p.current -} - -// CreatorsClientListByAccountPager provides operations for iterating over paged responses. -type CreatorsClientListByAccountPager struct { - client *CreatorsClient - current CreatorsClientListByAccountResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, CreatorsClientListByAccountResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *CreatorsClientListByAccountPager) 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 *CreatorsClientListByAccountPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.CreatorList.NextLink == nil || len(*p.current.CreatorList.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByAccountHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current CreatorsClientListByAccountResponse page. -func (p *CreatorsClientListByAccountPager) PageResponse() CreatorsClientListByAccountResponse { - return p.current -} diff --git a/sdk/resourcemanager/maps/armmaps/zz_generated_response_types.go b/sdk/resourcemanager/maps/armmaps/zz_generated_response_types.go index c439122f8a1a..669ee37ef694 100644 --- a/sdk/resourcemanager/maps/armmaps/zz_generated_response_types.go +++ b/sdk/resourcemanager/maps/armmaps/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,184 +8,82 @@ package armmaps -import "net/http" - // AccountsClientCreateOrUpdateResponse contains the response from method AccountsClient.CreateOrUpdate. type AccountsClientCreateOrUpdateResponse struct { - AccountsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientCreateOrUpdateResult contains the result from method AccountsClient.CreateOrUpdate. -type AccountsClientCreateOrUpdateResult struct { Account } // AccountsClientDeleteResponse contains the response from method AccountsClient.Delete. type AccountsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // AccountsClientGetResponse contains the response from method AccountsClient.Get. type AccountsClientGetResponse struct { - AccountsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientGetResult contains the result from method AccountsClient.Get. -type AccountsClientGetResult struct { Account } // AccountsClientListByResourceGroupResponse contains the response from method AccountsClient.ListByResourceGroup. type AccountsClientListByResourceGroupResponse struct { - AccountsClientListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientListByResourceGroupResult contains the result from method AccountsClient.ListByResourceGroup. -type AccountsClientListByResourceGroupResult struct { Accounts } // AccountsClientListBySubscriptionResponse contains the response from method AccountsClient.ListBySubscription. type AccountsClientListBySubscriptionResponse struct { - AccountsClientListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientListBySubscriptionResult contains the result from method AccountsClient.ListBySubscription. -type AccountsClientListBySubscriptionResult struct { Accounts } // AccountsClientListKeysResponse contains the response from method AccountsClient.ListKeys. type AccountsClientListKeysResponse struct { - AccountsClientListKeysResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientListKeysResult contains the result from method AccountsClient.ListKeys. -type AccountsClientListKeysResult struct { AccountKeys } // AccountsClientListSasResponse contains the response from method AccountsClient.ListSas. type AccountsClientListSasResponse struct { - AccountsClientListSasResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientListSasResult contains the result from method AccountsClient.ListSas. -type AccountsClientListSasResult struct { AccountSasToken } // AccountsClientRegenerateKeysResponse contains the response from method AccountsClient.RegenerateKeys. type AccountsClientRegenerateKeysResponse struct { - AccountsClientRegenerateKeysResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientRegenerateKeysResult contains the result from method AccountsClient.RegenerateKeys. -type AccountsClientRegenerateKeysResult struct { AccountKeys } // AccountsClientUpdateResponse contains the response from method AccountsClient.Update. type AccountsClientUpdateResponse struct { - AccountsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientUpdateResult contains the result from method AccountsClient.Update. -type AccountsClientUpdateResult struct { Account } // ClientListOperationsResponse contains the response from method Client.ListOperations. type ClientListOperationsResponse struct { - ClientListOperationsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListOperationsResult contains the result from method Client.ListOperations. -type ClientListOperationsResult struct { Operations } // ClientListSubscriptionOperationsResponse contains the response from method Client.ListSubscriptionOperations. type ClientListSubscriptionOperationsResponse struct { - ClientListSubscriptionOperationsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListSubscriptionOperationsResult contains the result from method Client.ListSubscriptionOperations. -type ClientListSubscriptionOperationsResult struct { Operations } // CreatorsClientCreateOrUpdateResponse contains the response from method CreatorsClient.CreateOrUpdate. type CreatorsClientCreateOrUpdateResponse struct { - CreatorsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CreatorsClientCreateOrUpdateResult contains the result from method CreatorsClient.CreateOrUpdate. -type CreatorsClientCreateOrUpdateResult struct { Creator } // CreatorsClientDeleteResponse contains the response from method CreatorsClient.Delete. type CreatorsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // CreatorsClientGetResponse contains the response from method CreatorsClient.Get. type CreatorsClientGetResponse struct { - CreatorsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CreatorsClientGetResult contains the result from method CreatorsClient.Get. -type CreatorsClientGetResult struct { Creator } // CreatorsClientListByAccountResponse contains the response from method CreatorsClient.ListByAccount. type CreatorsClientListByAccountResponse struct { - CreatorsClientListByAccountResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CreatorsClientListByAccountResult contains the result from method CreatorsClient.ListByAccount. -type CreatorsClientListByAccountResult struct { CreatorList } // CreatorsClientUpdateResponse contains the response from method CreatorsClient.Update. type CreatorsClientUpdateResponse struct { - CreatorsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CreatorsClientUpdateResult contains the result from method CreatorsClient.Update. -type CreatorsClientUpdateResult struct { Creator } diff --git a/sdk/resourcemanager/maps/armmaps/zz_generated_time_rfc3339.go b/sdk/resourcemanager/maps/armmaps/zz_generated_time_rfc3339.go index 4c128e180817..d3de2a41992d 100644 --- a/sdk/resourcemanager/maps/armmaps/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/maps/armmaps/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/mariadb/armmariadb/CHANGELOG.md b/sdk/resourcemanager/mariadb/armmariadb/CHANGELOG.md index a15daedbd393..436b21bdeedb 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/CHANGELOG.md +++ b/sdk/resourcemanager/mariadb/armmariadb/CHANGELOG.md @@ -1,5 +1,512 @@ # Release History +## 0.3.0 (2022-04-12) +### Breaking Changes + +- Function `NewLocationBasedRecommendedActionSessionsOperationStatusClient` return value(s) have been changed from `(*LocationBasedRecommendedActionSessionsOperationStatusClient)` to `(*LocationBasedRecommendedActionSessionsOperationStatusClient, error)` +- Function `*ManagementClient.BeginCreateRecommendedActionSession` return value(s) have been changed from `(ManagementClientCreateRecommendedActionSessionPollerResponse, error)` to `(*armruntime.Poller[ManagementClientCreateRecommendedActionSessionResponse], error)` +- Function `*ServersClient.ListByResourceGroup` parameter(s) have been changed from `(context.Context, string, *ServersClientListByResourceGroupOptions)` to `(string, *ServersClientListByResourceGroupOptions)` +- Function `*ServersClient.ListByResourceGroup` return value(s) have been changed from `(ServersClientListByResourceGroupResponse, error)` to `(*runtime.Pager[ServersClientListByResourceGroupResponse])` +- Function `*FirewallRulesClient.ListByServer` parameter(s) have been changed from `(context.Context, string, string, *FirewallRulesClientListByServerOptions)` to `(string, string, *FirewallRulesClientListByServerOptions)` +- Function `*FirewallRulesClient.ListByServer` return value(s) have been changed from `(FirewallRulesClientListByServerResponse, error)` to `(*runtime.Pager[FirewallRulesClientListByServerResponse])` +- Function `*FirewallRulesClient.BeginDelete` return value(s) have been changed from `(FirewallRulesClientDeletePollerResponse, error)` to `(*armruntime.Poller[FirewallRulesClientDeleteResponse], error)` +- Function `*PrivateEndpointConnectionsClient.ListByServer` return value(s) have been changed from `(*PrivateEndpointConnectionsClientListByServerPager)` to `(*runtime.Pager[PrivateEndpointConnectionsClientListByServerResponse])` +- Function `*ServersClient.BeginStop` return value(s) have been changed from `(ServersClientStopPollerResponse, error)` to `(*armruntime.Poller[ServersClientStopResponse], error)` +- Function `NewVirtualNetworkRulesClient` return value(s) have been changed from `(*VirtualNetworkRulesClient)` to `(*VirtualNetworkRulesClient, error)` +- Function `*VirtualNetworkRulesClient.ListByServer` return value(s) have been changed from `(*VirtualNetworkRulesClientListByServerPager)` to `(*runtime.Pager[VirtualNetworkRulesClientListByServerResponse])` +- Function `*ServerSecurityAlertPoliciesClient.ListByServer` return value(s) have been changed from `(*ServerSecurityAlertPoliciesClientListByServerPager)` to `(*runtime.Pager[ServerSecurityAlertPoliciesClientListByServerResponse])` +- Function `*PrivateEndpointConnectionsClient.BeginUpdateTags` return value(s) have been changed from `(PrivateEndpointConnectionsClientUpdateTagsPollerResponse, error)` to `(*armruntime.Poller[PrivateEndpointConnectionsClientUpdateTagsResponse], error)` +- Function `NewLocationBasedRecommendedActionSessionsResultClient` return value(s) have been changed from `(*LocationBasedRecommendedActionSessionsResultClient)` to `(*LocationBasedRecommendedActionSessionsResultClient, error)` +- Function `NewRecoverableServersClient` return value(s) have been changed from `(*RecoverableServersClient)` to `(*RecoverableServersClient, error)` +- Function `*DatabasesClient.BeginCreateOrUpdate` return value(s) have been changed from `(DatabasesClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[DatabasesClientCreateOrUpdateResponse], error)` +- Function `*PrivateLinkResourcesClient.ListByServer` return value(s) have been changed from `(*PrivateLinkResourcesClientListByServerPager)` to `(*runtime.Pager[PrivateLinkResourcesClientListByServerResponse])` +- Function `*PrivateEndpointConnectionsClient.BeginDelete` return value(s) have been changed from `(PrivateEndpointConnectionsClientDeletePollerResponse, error)` to `(*armruntime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error)` +- Function `NewDatabasesClient` return value(s) have been changed from `(*DatabasesClient)` to `(*DatabasesClient, error)` +- Function `*ServersClient.List` parameter(s) have been changed from `(context.Context, *ServersClientListOptions)` to `(*ServersClientListOptions)` +- Function `*ServersClient.List` return value(s) have been changed from `(ServersClientListResponse, error)` to `(*runtime.Pager[ServersClientListResponse])` +- Function `*ServersClient.BeginStart` return value(s) have been changed from `(ServersClientStartPollerResponse, error)` to `(*armruntime.Poller[ServersClientStartResponse], error)` +- Function `*LocationBasedPerformanceTierClient.List` parameter(s) have been changed from `(context.Context, string, *LocationBasedPerformanceTierClientListOptions)` to `(string, *LocationBasedPerformanceTierClientListOptions)` +- Function `*LocationBasedPerformanceTierClient.List` return value(s) have been changed from `(LocationBasedPerformanceTierClientListResponse, error)` to `(*runtime.Pager[LocationBasedPerformanceTierClientListResponse])` +- Function `*ConfigurationsClient.ListByServer` parameter(s) have been changed from `(context.Context, string, string, *ConfigurationsClientListByServerOptions)` to `(string, string, *ConfigurationsClientListByServerOptions)` +- Function `*ConfigurationsClient.ListByServer` return value(s) have been changed from `(ConfigurationsClientListByServerResponse, error)` to `(*runtime.Pager[ConfigurationsClientListByServerResponse])` +- Function `NewPrivateLinkResourcesClient` return value(s) have been changed from `(*PrivateLinkResourcesClient)` to `(*PrivateLinkResourcesClient, error)` +- Function `*ServerBasedPerformanceTierClient.List` parameter(s) have been changed from `(context.Context, string, string, *ServerBasedPerformanceTierClientListOptions)` to `(string, string, *ServerBasedPerformanceTierClientListOptions)` +- Function `*ServerBasedPerformanceTierClient.List` return value(s) have been changed from `(ServerBasedPerformanceTierClientListResponse, error)` to `(*runtime.Pager[ServerBasedPerformanceTierClientListResponse])` +- Function `*ServerParametersClient.BeginListUpdateConfigurations` return value(s) have been changed from `(ServerParametersClientListUpdateConfigurationsPollerResponse, error)` to `(*armruntime.Poller[ServerParametersClientListUpdateConfigurationsResponse], error)` +- Function `*LogFilesClient.ListByServer` parameter(s) have been changed from `(context.Context, string, string, *LogFilesClientListByServerOptions)` to `(string, string, *LogFilesClientListByServerOptions)` +- Function `*LogFilesClient.ListByServer` return value(s) have been changed from `(LogFilesClientListByServerResponse, error)` to `(*runtime.Pager[LogFilesClientListByServerResponse])` +- Function `*VirtualNetworkRulesClient.BeginCreateOrUpdate` return value(s) have been changed from `(VirtualNetworkRulesClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[VirtualNetworkRulesClientCreateOrUpdateResponse], error)` +- Function `*QueryTextsClient.ListByServer` return value(s) have been changed from `(*QueryTextsClientListByServerPager)` to `(*runtime.Pager[QueryTextsClientListByServerResponse])` +- Function `*RecommendedActionsClient.ListByServer` return value(s) have been changed from `(*RecommendedActionsClientListByServerPager)` to `(*runtime.Pager[RecommendedActionsClientListByServerResponse])` +- Function `NewAdvisorsClient` return value(s) have been changed from `(*AdvisorsClient)` to `(*AdvisorsClient, error)` +- Function `*ConfigurationsClient.BeginCreateOrUpdate` return value(s) have been changed from `(ConfigurationsClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[ConfigurationsClientCreateOrUpdateResponse], error)` +- Function `NewWaitStatisticsClient` return value(s) have been changed from `(*WaitStatisticsClient)` to `(*WaitStatisticsClient, error)` +- Function `NewReplicasClient` return value(s) have been changed from `(*ReplicasClient)` to `(*ReplicasClient, error)` +- Function `*DatabasesClient.BeginDelete` return value(s) have been changed from `(DatabasesClientDeletePollerResponse, error)` to `(*armruntime.Poller[DatabasesClientDeleteResponse], error)` +- Function `*FirewallRulesClient.BeginCreateOrUpdate` return value(s) have been changed from `(FirewallRulesClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[FirewallRulesClientCreateOrUpdateResponse], error)` +- Function `NewLocationBasedPerformanceTierClient` return value(s) have been changed from `(*LocationBasedPerformanceTierClient)` to `(*LocationBasedPerformanceTierClient, error)` +- Function `*ReplicasClient.ListByServer` parameter(s) have been changed from `(context.Context, string, string, *ReplicasClientListByServerOptions)` to `(string, string, *ReplicasClientListByServerOptions)` +- Function `*ReplicasClient.ListByServer` return value(s) have been changed from `(ReplicasClientListByServerResponse, error)` to `(*runtime.Pager[ReplicasClientListByServerResponse])` +- Function `NewServerSecurityAlertPoliciesClient` return value(s) have been changed from `(*ServerSecurityAlertPoliciesClient)` to `(*ServerSecurityAlertPoliciesClient, error)` +- Function `*PrivateEndpointConnectionsClient.BeginCreateOrUpdate` return value(s) have been changed from `(PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error)` +- Function `*LocationBasedRecommendedActionSessionsResultClient.List` return value(s) have been changed from `(*LocationBasedRecommendedActionSessionsResultClientListPager)` to `(*runtime.Pager[LocationBasedRecommendedActionSessionsResultClientListResponse])` +- Function `NewPrivateEndpointConnectionsClient` return value(s) have been changed from `(*PrivateEndpointConnectionsClient)` to `(*PrivateEndpointConnectionsClient, error)` +- Function `NewServerBasedPerformanceTierClient` return value(s) have been changed from `(*ServerBasedPerformanceTierClient)` to `(*ServerBasedPerformanceTierClient, error)` +- Function `NewLogFilesClient` return value(s) have been changed from `(*LogFilesClient)` to `(*LogFilesClient, error)` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `*ServersClient.BeginRestart` return value(s) have been changed from `(ServersClientRestartPollerResponse, error)` to `(*armruntime.Poller[ServersClientRestartResponse], error)` +- Function `NewTopQueryStatisticsClient` return value(s) have been changed from `(*TopQueryStatisticsClient)` to `(*TopQueryStatisticsClient, error)` +- Function `*TopQueryStatisticsClient.ListByServer` return value(s) have been changed from `(*TopQueryStatisticsClientListByServerPager)` to `(*runtime.Pager[TopQueryStatisticsClientListByServerResponse])` +- Function `*VirtualNetworkRulesClient.BeginDelete` return value(s) have been changed from `(VirtualNetworkRulesClientDeletePollerResponse, error)` to `(*armruntime.Poller[VirtualNetworkRulesClientDeleteResponse], error)` +- Function `NewCheckNameAvailabilityClient` return value(s) have been changed from `(*CheckNameAvailabilityClient)` to `(*CheckNameAvailabilityClient, error)` +- Function `NewManagementClient` return value(s) have been changed from `(*ManagementClient)` to `(*ManagementClient, error)` +- Function `*WaitStatisticsClient.ListByServer` return value(s) have been changed from `(*WaitStatisticsClientListByServerPager)` to `(*runtime.Pager[WaitStatisticsClientListByServerResponse])` +- Function `NewQueryTextsClient` return value(s) have been changed from `(*QueryTextsClient)` to `(*QueryTextsClient, error)` +- Function `NewRecommendedActionsClient` return value(s) have been changed from `(*RecommendedActionsClient)` to `(*RecommendedActionsClient, error)` +- Function `NewFirewallRulesClient` return value(s) have been changed from `(*FirewallRulesClient)` to `(*FirewallRulesClient, error)` +- Function `*ServersClient.BeginUpdate` return value(s) have been changed from `(ServersClientUpdatePollerResponse, error)` to `(*armruntime.Poller[ServersClientUpdateResponse], error)` +- Function `*ServersClient.BeginCreate` return value(s) have been changed from `(ServersClientCreatePollerResponse, error)` to `(*armruntime.Poller[ServersClientCreateResponse], error)` +- Function `*ServerSecurityAlertPoliciesClient.BeginCreateOrUpdate` return value(s) have been changed from `(ServerSecurityAlertPoliciesClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[ServerSecurityAlertPoliciesClientCreateOrUpdateResponse], error)` +- Function `*ServersClient.BeginDelete` return value(s) have been changed from `(ServersClientDeletePollerResponse, error)` to `(*armruntime.Poller[ServersClientDeleteResponse], error)` +- Function `*AdvisorsClient.ListByServer` return value(s) have been changed from `(*AdvisorsClientListByServerPager)` to `(*runtime.Pager[AdvisorsClientListByServerResponse])` +- Function `NewConfigurationsClient` return value(s) have been changed from `(*ConfigurationsClient)` to `(*ConfigurationsClient, error)` +- Function `NewServersClient` return value(s) have been changed from `(*ServersClient)` to `(*ServersClient, error)` +- Function `*DatabasesClient.ListByServer` parameter(s) have been changed from `(context.Context, string, string, *DatabasesClientListByServerOptions)` to `(string, string, *DatabasesClientListByServerOptions)` +- Function `*DatabasesClient.ListByServer` return value(s) have been changed from `(DatabasesClientListByServerResponse, error)` to `(*runtime.Pager[DatabasesClientListByServerResponse])` +- Function `NewServerParametersClient` return value(s) have been changed from `(*ServerParametersClient)` to `(*ServerParametersClient, error)` +- Type of `Operation.Properties` has been changed from `map[string]map[string]interface{}` to `map[string]interface{}` +- Type of `ErrorAdditionalInfo.Info` has been changed from `map[string]interface{}` to `interface{}` +- Type of `Advisor.Properties` has been changed from `map[string]interface{}` to `interface{}` +- Function `*ServersClientStopPoller.ResumeToken` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePoller.FinalResponse` has been removed +- Function `OperationOrigin.ToPtr` has been removed +- Function `*ServersClientUpdatePoller.Poll` has been removed +- Function `*ServerSecurityAlertPoliciesClientCreateOrUpdatePoller.Done` has been removed +- Function `ConfigurationsClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*PrivateEndpointConnectionsClientUpdateTagsPoller.Done` has been removed +- Function `*PrivateEndpointConnectionsClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*ConfigurationsClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*ServersClientUpdatePollerResponse.Resume` has been removed +- Function `*ServerSecurityAlertPoliciesClientCreateOrUpdatePoller.Poll` has been removed +- Function `*FirewallRulesClientDeletePoller.Poll` has been removed +- Function `*ServersClientStartPoller.ResumeToken` has been removed +- Function `PublicNetworkAccessEnum.ToPtr` has been removed +- Function `PrivateEndpointConnectionsClientUpdateTagsPollerResponse.PollUntilDone` has been removed +- Function `ServersClientRestartPollerResponse.PollUntilDone` has been removed +- Function `*LocationBasedRecommendedActionSessionsResultClientListPager.PageResponse` has been removed +- Function `VirtualNetworkRuleState.ToPtr` has been removed +- Function `*ServerSecurityAlertPoliciesClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*QueryTextsClientListByServerPager.NextPage` has been removed +- Function `*ServerSecurityAlertPoliciesClientListByServerPager.PageResponse` has been removed +- Function `*ServersClientRestartPollerResponse.Resume` has been removed +- Function `ServersClientStopPollerResponse.PollUntilDone` has been removed +- Function `*DatabasesClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `VirtualNetworkRulesClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*VirtualNetworkRulesClientDeletePoller.Poll` has been removed +- Function `*PrivateLinkResourcesClientListByServerPager.PageResponse` has been removed +- Function `*ConfigurationsClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*ServerSecurityAlertPoliciesClientListByServerPager.NextPage` has been removed +- Function `*DatabasesClientDeletePoller.Done` has been removed +- Function `*ManagementClientCreateRecommendedActionSessionPollerResponse.Resume` has been removed +- Function `*PrivateLinkResourcesClientListByServerPager.Err` has been removed +- Function `*ServersClientRestartPoller.FinalResponse` has been removed +- Function `*PrivateEndpointConnectionsClientUpdateTagsPoller.Poll` has been removed +- Function `*VirtualNetworkRulesClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*ServersClientStartPollerResponse.Resume` has been removed +- Function `*ServersClientCreatePoller.Poll` has been removed +- Function `*LocationBasedRecommendedActionSessionsResultClientListPager.NextPage` has been removed +- Function `*ServersClientDeletePoller.Poll` has been removed +- Function `*ConfigurationsClientCreateOrUpdatePoller.Poll` has been removed +- Function `ServerParametersClientListUpdateConfigurationsPollerResponse.PollUntilDone` has been removed +- Function `*FirewallRulesClientDeletePoller.FinalResponse` has been removed +- Function `*ServersClientCreatePoller.FinalResponse` has been removed +- Function `PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*FirewallRulesClientDeletePoller.ResumeToken` has been removed +- Function `*ServersClientStartPoller.Poll` has been removed +- Function `*FirewallRulesClientCreateOrUpdatePoller.Done` has been removed +- Function `*ServerSecurityAlertPoliciesClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*AdvisorsClientListByServerPager.NextPage` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePoller.Done` has been removed +- Function `*ServersClientDeletePollerResponse.Resume` has been removed +- Function `*VirtualNetworkRulesClientDeletePollerResponse.Resume` has been removed +- Function `*PrivateEndpointConnectionsClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*VirtualNetworkRulesClientDeletePoller.ResumeToken` has been removed +- Function `*ServersClientUpdatePoller.Done` has been removed +- Function `*DatabasesClientDeletePoller.FinalResponse` has been removed +- Function `*VirtualNetworkRulesClientCreateOrUpdatePoller.Done` has been removed +- Function `ServersClientStartPollerResponse.PollUntilDone` has been removed +- Function `*TopQueryStatisticsClientListByServerPager.PageResponse` has been removed +- Function `*ServersClientStopPoller.Poll` has been removed +- Function `ServersClientCreatePollerResponse.PollUntilDone` has been removed +- Function `DatabasesClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `ServerSecurityAlertPoliciesClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `ServerState.ToPtr` has been removed +- Function `SSLEnforcementEnum.ToPtr` has been removed +- Function `*ServersClientRestartPoller.Done` has been removed +- Function `*ServerParametersClientListUpdateConfigurationsPoller.Done` has been removed +- Function `*VirtualNetworkRulesClientListByServerPager.PageResponse` has been removed +- Function `*ServerParametersClientListUpdateConfigurationsPoller.ResumeToken` has been removed +- Function `*VirtualNetworkRulesClientDeletePoller.FinalResponse` has been removed +- Function `*VirtualNetworkRulesClientListByServerPager.Err` has been removed +- Function `*TopQueryStatisticsClientListByServerPager.Err` has been removed +- Function `*ManagementClientCreateRecommendedActionSessionPoller.ResumeToken` has been removed +- Function `ServersClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*ServersClientStopPollerResponse.Resume` has been removed +- Function `FirewallRulesClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePoller.ResumeToken` has been removed +- Function `*ServersClientDeletePoller.Done` has been removed +- Function `*ServerSecurityAlertPoliciesClientListByServerPager.Err` has been removed +- Function `*AdvisorsClientListByServerPager.Err` has been removed +- Function `MinimalTLSVersionEnum.ToPtr` has been removed +- Function `*VirtualNetworkRulesClientDeletePoller.Done` has been removed +- Function `*PrivateEndpointConnectionsClientCreateOrUpdatePoller.Done` has been removed +- Function `*ServersClientUpdatePoller.FinalResponse` has been removed +- Function `*VirtualNetworkRulesClientCreateOrUpdatePoller.Poll` has been removed +- Function `*ManagementClientCreateRecommendedActionSessionPoller.Poll` has been removed +- Function `*PrivateEndpointConnectionsClientUpdateTagsPollerResponse.Resume` has been removed +- Function `*DatabasesClientCreateOrUpdatePoller.Done` has been removed +- Function `*FirewallRulesClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*QueryTextsClientListByServerPager.Err` has been removed +- Function `*DatabasesClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `StorageAutogrow.ToPtr` has been removed +- Function `SKUTier.ToPtr` has been removed +- Function `*ServersClientStartPoller.Done` has been removed +- Function `DatabasesClientDeletePollerResponse.PollUntilDone` has been removed +- Function `CreateMode.ToPtr` has been removed +- Function `*ServersClientUpdatePoller.ResumeToken` has been removed +- Function `*DatabasesClientDeletePoller.Poll` has been removed +- Function `*DatabasesClientDeletePollerResponse.Resume` has been removed +- Function `*ServerSecurityAlertPoliciesClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `ServersClientUpdatePollerResponse.PollUntilDone` has been removed +- Function `*ServersClientRestartPoller.Poll` has been removed +- Function `*ManagementClientCreateRecommendedActionSessionPoller.FinalResponse` has been removed +- Function `*ServerParametersClientListUpdateConfigurationsPoller.FinalResponse` has been removed +- Function `PrivateEndpointProvisioningState.ToPtr` has been removed +- Function `*ServerParametersClientListUpdateConfigurationsPollerResponse.Resume` has been removed +- Function `FirewallRulesClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePollerResponse.Resume` has been removed +- Function `*ServersClientStartPoller.FinalResponse` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePoller.Poll` has been removed +- Function `VirtualNetworkRulesClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `GeoRedundantBackup.ToPtr` has been removed +- Function `QueryPerformanceInsightResetDataResultState.ToPtr` has been removed +- Function `*TopQueryStatisticsClientListByServerPager.NextPage` has been removed +- Function `PrivateEndpointConnectionsClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*ServersClientCreatePoller.ResumeToken` has been removed +- Function `*FirewallRulesClientDeletePoller.Done` has been removed +- Function `*PrivateEndpointConnectionsClientUpdateTagsPoller.FinalResponse` has been removed +- Function `ServerSecurityAlertPolicyState.ToPtr` has been removed +- Function `*WaitStatisticsClientListByServerPager.PageResponse` has been removed +- Function `*RecommendedActionsClientListByServerPager.PageResponse` has been removed +- Function `*ServersClientCreatePollerResponse.Resume` has been removed +- Function `*PrivateEndpointConnectionsClientUpdateTagsPoller.ResumeToken` has been removed +- Function `*DatabasesClientDeletePoller.ResumeToken` has been removed +- Function `*FirewallRulesClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*RecommendedActionsClientListByServerPager.NextPage` has been removed +- Function `*ServersClientStopPoller.FinalResponse` has been removed +- Function `*AdvisorsClientListByServerPager.PageResponse` has been removed +- Function `*PrivateEndpointConnectionsClientCreateOrUpdatePoller.Poll` has been removed +- Function `*QueryTextsClientListByServerPager.PageResponse` has been removed +- Function `*LocationBasedRecommendedActionSessionsResultClientListPager.Err` has been removed +- Function `*PrivateEndpointConnectionsClientListByServerPager.Err` has been removed +- Function `*WaitStatisticsClientListByServerPager.NextPage` has been removed +- Function `*PrivateEndpointConnectionsClientListByServerPager.NextPage` has been removed +- Function `*WaitStatisticsClientListByServerPager.Err` has been removed +- Function `*DatabasesClientCreateOrUpdatePoller.Poll` has been removed +- Function `*ServersClientStopPoller.Done` has been removed +- Function `*PrivateLinkResourcesClientListByServerPager.NextPage` has been removed +- Function `*ConfigurationsClientCreateOrUpdatePoller.Done` has been removed +- Function `*VirtualNetworkRulesClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*FirewallRulesClientDeletePollerResponse.Resume` has been removed +- Function `ServerVersion.ToPtr` has been removed +- Function `*FirewallRulesClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*DatabasesClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*ServersClientDeletePoller.FinalResponse` has been removed +- Function `*ServersClientCreatePoller.Done` has been removed +- Function `*VirtualNetworkRulesClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `PrivateLinkServiceConnectionStateStatus.ToPtr` has been removed +- Function `ManagementClientCreateRecommendedActionSessionPollerResponse.PollUntilDone` has been removed +- Function `*VirtualNetworkRulesClientListByServerPager.NextPage` has been removed +- Function `PrivateLinkServiceConnectionStateActionsRequire.ToPtr` has been removed +- Function `SecurityAlertPolicyName.ToPtr` has been removed +- Function `*ManagementClientCreateRecommendedActionSessionPoller.Done` has been removed +- Function `*ServersClientRestartPoller.ResumeToken` has been removed +- Function `*ServerParametersClientListUpdateConfigurationsPoller.Poll` has been removed +- Function `*ServersClientDeletePoller.ResumeToken` has been removed +- Function `*FirewallRulesClientCreateOrUpdatePoller.Poll` has been removed +- Function `*RecommendedActionsClientListByServerPager.Err` has been removed +- Function `*PrivateEndpointConnectionsClientListByServerPager.PageResponse` has been removed +- Function `*ConfigurationsClientCreateOrUpdatePoller.FinalResponse` has been removed +- Struct `AdvisorsClientGetResult` has been removed +- Struct `AdvisorsClientListByServerPager` has been removed +- Struct `AdvisorsClientListByServerResult` has been removed +- Struct `CheckNameAvailabilityClientExecuteResult` has been removed +- Struct `ConfigurationsClientCreateOrUpdatePoller` has been removed +- Struct `ConfigurationsClientCreateOrUpdatePollerResponse` has been removed +- Struct `ConfigurationsClientCreateOrUpdateResult` has been removed +- Struct `ConfigurationsClientGetResult` has been removed +- Struct `ConfigurationsClientListByServerResult` has been removed +- Struct `DatabasesClientCreateOrUpdatePoller` has been removed +- Struct `DatabasesClientCreateOrUpdatePollerResponse` has been removed +- Struct `DatabasesClientCreateOrUpdateResult` has been removed +- Struct `DatabasesClientDeletePoller` has been removed +- Struct `DatabasesClientDeletePollerResponse` has been removed +- Struct `DatabasesClientGetResult` has been removed +- Struct `DatabasesClientListByServerResult` has been removed +- Struct `FirewallRulesClientCreateOrUpdatePoller` has been removed +- Struct `FirewallRulesClientCreateOrUpdatePollerResponse` has been removed +- Struct `FirewallRulesClientCreateOrUpdateResult` has been removed +- Struct `FirewallRulesClientDeletePoller` has been removed +- Struct `FirewallRulesClientDeletePollerResponse` has been removed +- Struct `FirewallRulesClientGetResult` has been removed +- Struct `FirewallRulesClientListByServerResult` has been removed +- Struct `LocationBasedPerformanceTierClientListResult` has been removed +- Struct `LocationBasedRecommendedActionSessionsOperationStatusClientGetResult` has been removed +- Struct `LocationBasedRecommendedActionSessionsResultClientListPager` has been removed +- Struct `LocationBasedRecommendedActionSessionsResultClientListResult` has been removed +- Struct `LogFilesClientListByServerResult` has been removed +- Struct `ManagementClientCreateRecommendedActionSessionPoller` has been removed +- Struct `ManagementClientCreateRecommendedActionSessionPollerResponse` has been removed +- Struct `ManagementClientResetQueryPerformanceInsightDataResult` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `PrivateEndpointConnectionsClientCreateOrUpdatePoller` has been removed +- Struct `PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse` has been removed +- Struct `PrivateEndpointConnectionsClientCreateOrUpdateResult` has been removed +- Struct `PrivateEndpointConnectionsClientDeletePoller` has been removed +- Struct `PrivateEndpointConnectionsClientDeletePollerResponse` has been removed +- Struct `PrivateEndpointConnectionsClientGetResult` has been removed +- Struct `PrivateEndpointConnectionsClientListByServerPager` has been removed +- Struct `PrivateEndpointConnectionsClientListByServerResult` has been removed +- Struct `PrivateEndpointConnectionsClientUpdateTagsPoller` has been removed +- Struct `PrivateEndpointConnectionsClientUpdateTagsPollerResponse` has been removed +- Struct `PrivateEndpointConnectionsClientUpdateTagsResult` has been removed +- Struct `PrivateLinkResourcesClientGetResult` has been removed +- Struct `PrivateLinkResourcesClientListByServerPager` has been removed +- Struct `PrivateLinkResourcesClientListByServerResult` has been removed +- Struct `QueryTextsClientGetResult` has been removed +- Struct `QueryTextsClientListByServerPager` has been removed +- Struct `QueryTextsClientListByServerResult` has been removed +- Struct `RecommendedActionsClientGetResult` has been removed +- Struct `RecommendedActionsClientListByServerPager` has been removed +- Struct `RecommendedActionsClientListByServerResult` has been removed +- Struct `RecoverableServersClientGetResult` has been removed +- Struct `ReplicasClientListByServerResult` has been removed +- Struct `ServerBasedPerformanceTierClientListResult` has been removed +- Struct `ServerParametersClientListUpdateConfigurationsPoller` has been removed +- Struct `ServerParametersClientListUpdateConfigurationsPollerResponse` has been removed +- Struct `ServerParametersClientListUpdateConfigurationsResult` has been removed +- Struct `ServerSecurityAlertPoliciesClientCreateOrUpdatePoller` has been removed +- Struct `ServerSecurityAlertPoliciesClientCreateOrUpdatePollerResponse` has been removed +- Struct `ServerSecurityAlertPoliciesClientCreateOrUpdateResult` has been removed +- Struct `ServerSecurityAlertPoliciesClientGetResult` has been removed +- Struct `ServerSecurityAlertPoliciesClientListByServerPager` has been removed +- Struct `ServerSecurityAlertPoliciesClientListByServerResult` has been removed +- Struct `ServersClientCreatePoller` has been removed +- Struct `ServersClientCreatePollerResponse` has been removed +- Struct `ServersClientCreateResult` has been removed +- Struct `ServersClientDeletePoller` has been removed +- Struct `ServersClientDeletePollerResponse` has been removed +- Struct `ServersClientGetResult` has been removed +- Struct `ServersClientListByResourceGroupResult` has been removed +- Struct `ServersClientListResult` has been removed +- Struct `ServersClientRestartPoller` has been removed +- Struct `ServersClientRestartPollerResponse` has been removed +- Struct `ServersClientStartPoller` has been removed +- Struct `ServersClientStartPollerResponse` has been removed +- Struct `ServersClientStopPoller` has been removed +- Struct `ServersClientStopPollerResponse` has been removed +- Struct `ServersClientUpdatePoller` has been removed +- Struct `ServersClientUpdatePollerResponse` has been removed +- Struct `ServersClientUpdateResult` has been removed +- Struct `TopQueryStatisticsClientGetResult` has been removed +- Struct `TopQueryStatisticsClientListByServerPager` has been removed +- Struct `TopQueryStatisticsClientListByServerResult` has been removed +- Struct `VirtualNetworkRulesClientCreateOrUpdatePoller` has been removed +- Struct `VirtualNetworkRulesClientCreateOrUpdatePollerResponse` has been removed +- Struct `VirtualNetworkRulesClientCreateOrUpdateResult` has been removed +- Struct `VirtualNetworkRulesClientDeletePoller` has been removed +- Struct `VirtualNetworkRulesClientDeletePollerResponse` has been removed +- Struct `VirtualNetworkRulesClientGetResult` has been removed +- Struct `VirtualNetworkRulesClientListByServerPager` has been removed +- Struct `VirtualNetworkRulesClientListByServerResult` has been removed +- Struct `WaitStatisticsClientGetResult` has been removed +- Struct `WaitStatisticsClientListByServerPager` has been removed +- Struct `WaitStatisticsClientListByServerResult` has been removed +- Field `RawResponse` of struct `ServersClientRestartResponse` has been removed +- Field `ServerBasedPerformanceTierClientListResult` of struct `ServerBasedPerformanceTierClientListResponse` has been removed +- Field `RawResponse` of struct `ServerBasedPerformanceTierClientListResponse` has been removed +- Field `WaitStatisticsClientListByServerResult` of struct `WaitStatisticsClientListByServerResponse` has been removed +- Field `RawResponse` of struct `WaitStatisticsClientListByServerResponse` has been removed +- Field `RawResponse` of struct `ServersClientStopResponse` has been removed +- Field `FirewallRulesClientListByServerResult` of struct `FirewallRulesClientListByServerResponse` has been removed +- Field `RawResponse` of struct `FirewallRulesClientListByServerResponse` has been removed +- Field `DatabasesClientCreateOrUpdateResult` of struct `DatabasesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `DatabasesClientCreateOrUpdateResponse` has been removed +- Field `ManagementClientResetQueryPerformanceInsightDataResult` of struct `ManagementClientResetQueryPerformanceInsightDataResponse` has been removed +- Field `RawResponse` of struct `ManagementClientResetQueryPerformanceInsightDataResponse` has been removed +- Field `DatabasesClientListByServerResult` of struct `DatabasesClientListByServerResponse` has been removed +- Field `RawResponse` of struct `DatabasesClientListByServerResponse` has been removed +- Field `PrivateLinkResourcesClientGetResult` of struct `PrivateLinkResourcesClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateLinkResourcesClientGetResponse` has been removed +- Field `WaitStatisticsClientGetResult` of struct `WaitStatisticsClientGetResponse` has been removed +- Field `RawResponse` of struct `WaitStatisticsClientGetResponse` has been removed +- Field `ServersClientCreateResult` of struct `ServersClientCreateResponse` has been removed +- Field `RawResponse` of struct `ServersClientCreateResponse` has been removed +- Field `LocationBasedRecommendedActionSessionsOperationStatusClientGetResult` of struct `LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse` has been removed +- Field `RawResponse` of struct `LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse` has been removed +- Field `ServersClientGetResult` of struct `ServersClientGetResponse` has been removed +- Field `RawResponse` of struct `ServersClientGetResponse` has been removed +- Field `LocationBasedPerformanceTierClientListResult` of struct `LocationBasedPerformanceTierClientListResponse` has been removed +- Field `RawResponse` of struct `LocationBasedPerformanceTierClientListResponse` has been removed +- Field `PrivateEndpointConnectionsClientUpdateTagsResult` of struct `PrivateEndpointConnectionsClientUpdateTagsResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientUpdateTagsResponse` has been removed +- Field `PrivateEndpointConnectionsClientListByServerResult` of struct `PrivateEndpointConnectionsClientListByServerResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientListByServerResponse` has been removed +- Field `PrivateLinkResourcesClientListByServerResult` of struct `PrivateLinkResourcesClientListByServerResponse` has been removed +- Field `RawResponse` of struct `PrivateLinkResourcesClientListByServerResponse` has been removed +- Field `RawResponse` of struct `DatabasesClientDeleteResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `RecommendedActionsClientListByServerResult` of struct `RecommendedActionsClientListByServerResponse` has been removed +- Field `RawResponse` of struct `RecommendedActionsClientListByServerResponse` has been removed +- Field `AdvisorsClientGetResult` of struct `AdvisorsClientGetResponse` has been removed +- Field `RawResponse` of struct `AdvisorsClientGetResponse` has been removed +- Field `RawResponse` of struct `VirtualNetworkRulesClientDeleteResponse` has been removed +- Field `AdvisorsClientListByServerResult` of struct `AdvisorsClientListByServerResponse` has been removed +- Field `RawResponse` of struct `AdvisorsClientListByServerResponse` has been removed +- Field `FirewallRulesClientCreateOrUpdateResult` of struct `FirewallRulesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `FirewallRulesClientCreateOrUpdateResponse` has been removed +- Field `ReplicasClientListByServerResult` of struct `ReplicasClientListByServerResponse` has been removed +- Field `RawResponse` of struct `ReplicasClientListByServerResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientDeleteResponse` has been removed +- Field `VirtualNetworkRulesClientGetResult` of struct `VirtualNetworkRulesClientGetResponse` has been removed +- Field `RawResponse` of struct `VirtualNetworkRulesClientGetResponse` has been removed +- Field `TopQueryStatisticsClientListByServerResult` of struct `TopQueryStatisticsClientListByServerResponse` has been removed +- Field `RawResponse` of struct `TopQueryStatisticsClientListByServerResponse` has been removed +- Field `PrivateEndpointConnectionsClientGetResult` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `DatabasesClientGetResult` of struct `DatabasesClientGetResponse` has been removed +- Field `RawResponse` of struct `DatabasesClientGetResponse` has been removed +- Field `RecommendedActionsClientGetResult` of struct `RecommendedActionsClientGetResponse` has been removed +- Field `RawResponse` of struct `RecommendedActionsClientGetResponse` has been removed +- Field `ServerSecurityAlertPoliciesClientListByServerResult` of struct `ServerSecurityAlertPoliciesClientListByServerResponse` has been removed +- Field `RawResponse` of struct `ServerSecurityAlertPoliciesClientListByServerResponse` has been removed +- Field `LogFilesClientListByServerResult` of struct `LogFilesClientListByServerResponse` has been removed +- Field `RawResponse` of struct `LogFilesClientListByServerResponse` has been removed +- Field `ServersClientListByResourceGroupResult` of struct `ServersClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `ServersClientListByResourceGroupResponse` has been removed +- Field `VirtualNetworkRulesClientListByServerResult` of struct `VirtualNetworkRulesClientListByServerResponse` has been removed +- Field `RawResponse` of struct `VirtualNetworkRulesClientListByServerResponse` has been removed +- Field `QueryTextsClientGetResult` of struct `QueryTextsClientGetResponse` has been removed +- Field `RawResponse` of struct `QueryTextsClientGetResponse` has been removed +- Field `RawResponse` of struct `ServersClientDeleteResponse` has been removed +- Field `ConfigurationsClientGetResult` of struct `ConfigurationsClientGetResponse` has been removed +- Field `RawResponse` of struct `ConfigurationsClientGetResponse` has been removed +- Field `RawResponse` of struct `FirewallRulesClientDeleteResponse` has been removed +- Field `CheckNameAvailabilityClientExecuteResult` of struct `CheckNameAvailabilityClientExecuteResponse` has been removed +- Field `RawResponse` of struct `CheckNameAvailabilityClientExecuteResponse` has been removed +- Field `ServerParametersClientListUpdateConfigurationsResult` of struct `ServerParametersClientListUpdateConfigurationsResponse` has been removed +- Field `RawResponse` of struct `ServerParametersClientListUpdateConfigurationsResponse` has been removed +- Field `RawResponse` of struct `ManagementClientCreateRecommendedActionSessionResponse` has been removed +- Field `TopQueryStatisticsClientGetResult` of struct `TopQueryStatisticsClientGetResponse` has been removed +- Field `RawResponse` of struct `TopQueryStatisticsClientGetResponse` has been removed +- Field `ConfigurationsClientListByServerResult` of struct `ConfigurationsClientListByServerResponse` has been removed +- Field `RawResponse` of struct `ConfigurationsClientListByServerResponse` has been removed +- Field `ServersClientUpdateResult` of struct `ServersClientUpdateResponse` has been removed +- Field `RawResponse` of struct `ServersClientUpdateResponse` has been removed +- Field `ServersClientListResult` of struct `ServersClientListResponse` has been removed +- Field `RawResponse` of struct `ServersClientListResponse` has been removed +- Field `FirewallRulesClientGetResult` of struct `FirewallRulesClientGetResponse` has been removed +- Field `RawResponse` of struct `FirewallRulesClientGetResponse` has been removed +- Field `RecoverableServersClientGetResult` of struct `RecoverableServersClientGetResponse` has been removed +- Field `RawResponse` of struct `RecoverableServersClientGetResponse` has been removed +- Field `VirtualNetworkRulesClientCreateOrUpdateResult` of struct `VirtualNetworkRulesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `VirtualNetworkRulesClientCreateOrUpdateResponse` has been removed +- Field `ServerSecurityAlertPoliciesClientGetResult` of struct `ServerSecurityAlertPoliciesClientGetResponse` has been removed +- Field `RawResponse` of struct `ServerSecurityAlertPoliciesClientGetResponse` has been removed +- Field `ServerSecurityAlertPoliciesClientCreateOrUpdateResult` of struct `ServerSecurityAlertPoliciesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ServerSecurityAlertPoliciesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ServersClientStartResponse` has been removed +- Field `LocationBasedRecommendedActionSessionsResultClientListResult` of struct `LocationBasedRecommendedActionSessionsResultClientListResponse` has been removed +- Field `RawResponse` of struct `LocationBasedRecommendedActionSessionsResultClientListResponse` has been removed +- Field `PrivateEndpointConnectionsClientCreateOrUpdateResult` of struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` has been removed +- Field `QueryTextsClientListByServerResult` of struct `QueryTextsClientListByServerResponse` has been removed +- Field `RawResponse` of struct `QueryTextsClientListByServerResponse` has been removed +- Field `ConfigurationsClientCreateOrUpdateResult` of struct `ConfigurationsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ConfigurationsClientCreateOrUpdateResponse` has been removed + +### Features Added + +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsClientUpdateTagsResponse` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New anonymous field `FirewallRule` in struct `FirewallRulesClientGetResponse` +- New anonymous field `Database` in struct `DatabasesClientGetResponse` +- New field `ResumeToken` in struct `ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions` +- New anonymous field `PerformanceTierListResult` in struct `ServerBasedPerformanceTierClientListResponse` +- New anonymous field `Configuration` in struct `ConfigurationsClientCreateOrUpdateResponse` +- New anonymous field `ServerListResult` in struct `ServersClientListByResourceGroupResponse` +- New anonymous field `VirtualNetworkRule` in struct `VirtualNetworkRulesClientCreateOrUpdateResponse` +- New anonymous field `WaitStatisticsResultList` in struct `WaitStatisticsClientListByServerResponse` +- New field `ResumeToken` in struct `PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions` +- New field `ResumeToken` in struct `ServersClientBeginCreateOptions` +- New field `ResumeToken` in struct `PrivateEndpointConnectionsClientBeginDeleteOptions` +- New anonymous field `RecommendedActionSessionsOperationStatus` in struct `LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse` +- New anonymous field `WaitStatistic` in struct `WaitStatisticsClientGetResponse` +- New anonymous field `AdvisorsResultList` in struct `AdvisorsClientListByServerResponse` +- New anonymous field `FirewallRuleListResult` in struct `FirewallRulesClientListByServerResponse` +- New anonymous field `Configuration` in struct `ConfigurationsClientGetResponse` +- New anonymous field `ServerSecurityAlertPolicyListResult` in struct `ServerSecurityAlertPoliciesClientListByServerResponse` +- New anonymous field `PerformanceTierListResult` in struct `LocationBasedPerformanceTierClientListResponse` +- New anonymous field `Server` in struct `ServersClientGetResponse` +- New anonymous field `RecommendationAction` in struct `RecommendedActionsClientGetResponse` +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsClientGetResponse` +- New field `ResumeToken` in struct `VirtualNetworkRulesClientBeginDeleteOptions` +- New anonymous field `FirewallRule` in struct `FirewallRulesClientCreateOrUpdateResponse` +- New field `ResumeToken` in struct `ManagementClientBeginCreateRecommendedActionSessionOptions` +- New field `ResumeToken` in struct `ServersClientBeginDeleteOptions` +- New field `ResumeToken` in struct `VirtualNetworkRulesClientBeginCreateOrUpdateOptions` +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` +- New field `ResumeToken` in struct `PrivateEndpointConnectionsClientBeginUpdateTagsOptions` +- New anonymous field `PrivateLinkResource` in struct `PrivateLinkResourcesClientGetResponse` +- New field `ResumeToken` in struct `ServersClientBeginUpdateOptions` +- New anonymous field `Server` in struct `ServersClientUpdateResponse` +- New anonymous field `LogFileListResult` in struct `LogFilesClientListByServerResponse` +- New anonymous field `Server` in struct `ServersClientCreateResponse` +- New field `ResumeToken` in struct `ServersClientBeginStopOptions` +- New anonymous field `QueryText` in struct `QueryTextsClientGetResponse` +- New anonymous field `NameAvailability` in struct `CheckNameAvailabilityClientExecuteResponse` +- New anonymous field `ServerListResult` in struct `ServersClientListResponse` +- New anonymous field `QueryTextsResultList` in struct `QueryTextsClientListByServerResponse` +- New anonymous field `Database` in struct `DatabasesClientCreateOrUpdateResponse` +- New anonymous field `DatabaseListResult` in struct `DatabasesClientListByServerResponse` +- New field `ResumeToken` in struct `ConfigurationsClientBeginCreateOrUpdateOptions` +- New field `ResumeToken` in struct `ServerParametersClientBeginListUpdateConfigurationsOptions` +- New anonymous field `RecommendationActionsResultList` in struct `LocationBasedRecommendedActionSessionsResultClientListResponse` +- New anonymous field `ServerListResult` in struct `ReplicasClientListByServerResponse` +- New field `ResumeToken` in struct `DatabasesClientBeginCreateOrUpdateOptions` +- New anonymous field `RecommendationActionsResultList` in struct `RecommendedActionsClientListByServerResponse` +- New field `ResumeToken` in struct `ServersClientBeginRestartOptions` +- New field `ResumeToken` in struct `FirewallRulesClientBeginCreateOrUpdateOptions` +- New anonymous field `Advisor` in struct `AdvisorsClientGetResponse` +- New anonymous field `ConfigurationListResult` in struct `ServerParametersClientListUpdateConfigurationsResponse` +- New anonymous field `ServerSecurityAlertPolicy` in struct `ServerSecurityAlertPoliciesClientCreateOrUpdateResponse` +- New anonymous field `ServerSecurityAlertPolicy` in struct `ServerSecurityAlertPoliciesClientGetResponse` +- New field `ResumeToken` in struct `ServersClientBeginStartOptions` +- New field `ResumeToken` in struct `FirewallRulesClientBeginDeleteOptions` +- New anonymous field `ConfigurationListResult` in struct `ConfigurationsClientListByServerResponse` +- New anonymous field `PrivateEndpointConnectionListResult` in struct `PrivateEndpointConnectionsClientListByServerResponse` +- New anonymous field `QueryPerformanceInsightResetDataResult` in struct `ManagementClientResetQueryPerformanceInsightDataResponse` +- New anonymous field `VirtualNetworkRuleListResult` in struct `VirtualNetworkRulesClientListByServerResponse` +- New anonymous field `RecoverableServerResource` in struct `RecoverableServersClientGetResponse` +- New anonymous field `QueryStatistic` in struct `TopQueryStatisticsClientGetResponse` +- New anonymous field `PrivateLinkResourceListResult` in struct `PrivateLinkResourcesClientListByServerResponse` +- New field `ResumeToken` in struct `DatabasesClientBeginDeleteOptions` +- New anonymous field `VirtualNetworkRule` in struct `VirtualNetworkRulesClientGetResponse` +- New anonymous field `TopQueryStatisticsResultList` in struct `TopQueryStatisticsClientListByServerResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/mariadb/armmariadb/README.md b/sdk/resourcemanager/mariadb/armmariadb/README.md index bb95696c53c4..19190a6ced9a 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/README.md +++ b/sdk/resourcemanager/mariadb/armmariadb/README.md @@ -11,7 +11,7 @@ The `armmariadb` module provides operations for working with Azure OSS Databases ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure OSS Databases 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 -client := armmariadb.NewPrivateEndpointConnectionsClient(, cred, nil) +client, err := armmariadb.NewPrivateEndpointConnectionsClient(, cred, nil) ``` 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 -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armmariadb.NewPrivateEndpointConnectionsClient(, cred, &options) +client, err := armmariadb.NewPrivateEndpointConnectionsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/mariadb/armmariadb/autorest.md b/sdk/resourcemanager/mariadb/armmariadb/autorest.md index dc1619310d18..676e62f9e6f9 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/autorest.md +++ b/sdk/resourcemanager/mariadb/armmariadb/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/mariadb/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/mariadb/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/mariadb/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/mariadb/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/mariadb/armmariadb/go.mod b/sdk/resourcemanager/mariadb/armmariadb/go.mod index f0aa7902c925..a3f915309574 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/go.mod +++ b/sdk/resourcemanager/mariadb/armmariadb/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/mariadb/armmariadb/go.sum b/sdk/resourcemanager/mariadb/armmariadb/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/go.sum +++ b/sdk/resourcemanager/mariadb/armmariadb/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm 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/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/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-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_advisors_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_advisors_client_test.go index 76589013186f..4e3cb51ebe00 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_advisors_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_advisors_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,46 +16,57 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/AdvisorsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/AdvisorsGet.json func ExampleAdvisorsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewAdvisorsClient("", cred, nil) + client, err := armmariadb.NewAdvisorsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AdvisorsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/AdvisorsListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/AdvisorsListByServer.json func ExampleAdvisorsClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewAdvisorsClient("", cred, nil) + client, err := armmariadb.NewAdvisorsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByServer("", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_checknameavailability_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_checknameavailability_client_test.go index c8430ed6b8bb..ca8ce74bc372 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_checknameavailability_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_checknameavailability_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,22 +17,29 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/CheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/CheckNameAvailability.json func ExampleCheckNameAvailabilityClient_Execute() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewCheckNameAvailabilityClient("", cred, nil) + client, err := armmariadb.NewCheckNameAvailabilityClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Execute(ctx, armmariadb.NameAvailabilityRequest{ - Name: to.StringPtr(""), - Type: to.StringPtr(""), + Name: to.Ptr(""), + Type: to.Ptr(""), }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.CheckNameAvailabilityClientExecuteResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_configurations_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_configurations_client_test.go index 8bc88295eeaa..a4198da72cdf 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_configurations_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_configurations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,68 +19,94 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ConfigurationCreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ConfigurationCreateOrUpdate.json func ExampleConfigurationsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewConfigurationsClient("", cred, nil) + client, err := armmariadb.NewConfigurationsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "", "", "", armmariadb.Configuration{ Properties: &armmariadb.ConfigurationProperties{ - Source: to.StringPtr(""), - Value: to.StringPtr(""), + Source: to.Ptr(""), + Value: to.Ptr(""), }, }, - nil) + &armmariadb.ConfigurationsClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.ConfigurationsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ConfigurationGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ConfigurationGet.json func ExampleConfigurationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewConfigurationsClient("", cred, nil) + client, err := armmariadb.NewConfigurationsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ConfigurationsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ConfigurationListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ConfigurationListByServer.json func ExampleConfigurationsClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewConfigurationsClient("", cred, nil) - res, err := client.ListByServer(ctx, - "", + client, err := armmariadb.NewConfigurationsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.ListByServer("", "", nil) - if err != nil { - log.Fatal(err) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.ConfigurationsClientListByServerResult) } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_databases_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_databases_client_test.go index 7d4a69a91f4e..fcaf194f7278 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_databases_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_databases_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,90 +19,123 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/DatabaseCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/DatabaseCreate.json func ExampleDatabasesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewDatabasesClient("", cred, nil) + client, err := armmariadb.NewDatabasesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "", "", "", armmariadb.Database{ Properties: &armmariadb.DatabaseProperties{ - Charset: to.StringPtr(""), - Collation: to.StringPtr(""), + Charset: to.Ptr(""), + Collation: to.Ptr(""), }, }, - nil) + &armmariadb.DatabasesClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.DatabasesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/DatabaseDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/DatabaseDelete.json func ExampleDatabasesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewDatabasesClient("", cred, nil) + client, err := armmariadb.NewDatabasesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "", "", "", - nil) + &armmariadb.DatabasesClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/DatabaseGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/DatabaseGet.json func ExampleDatabasesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewDatabasesClient("", cred, nil) + client, err := armmariadb.NewDatabasesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.DatabasesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/DatabaseListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/DatabaseListByServer.json func ExampleDatabasesClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewDatabasesClient("", cred, nil) - res, err := client.ListByServer(ctx, - "", + client, err := armmariadb.NewDatabasesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.ListByServer("", "", nil) - if err != nil { - log.Fatal(err) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.DatabasesClientListByServerResult) } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_firewallrules_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_firewallrules_client_test.go index 291297ab3c88..5f598d6f2374 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_firewallrules_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_firewallrules_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,90 +19,123 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/FirewallRuleCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/FirewallRuleCreate.json func ExampleFirewallRulesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewFirewallRulesClient("", cred, nil) + client, err := armmariadb.NewFirewallRulesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "", "", "", armmariadb.FirewallRule{ Properties: &armmariadb.FirewallRuleProperties{ - EndIPAddress: to.StringPtr(""), - StartIPAddress: to.StringPtr(""), + EndIPAddress: to.Ptr(""), + StartIPAddress: to.Ptr(""), }, }, - nil) + &armmariadb.FirewallRulesClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.FirewallRulesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/FirewallRuleDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/FirewallRuleDelete.json func ExampleFirewallRulesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewFirewallRulesClient("", cred, nil) + client, err := armmariadb.NewFirewallRulesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "", "", "", - nil) + &armmariadb.FirewallRulesClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/FirewallRuleGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/FirewallRuleGet.json func ExampleFirewallRulesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewFirewallRulesClient("", cred, nil) + client, err := armmariadb.NewFirewallRulesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.FirewallRulesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/FirewallRuleListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/FirewallRuleListByServer.json func ExampleFirewallRulesClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewFirewallRulesClient("", cred, nil) - res, err := client.ListByServer(ctx, - "", + client, err := armmariadb.NewFirewallRulesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.ListByServer("", "", nil) - if err != nil { - log.Fatal(err) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.FirewallRulesClientListByServerResult) } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_locationbasedperformancetier_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_locationbasedperformancetier_client_test.go index eda46ffb13bd..93c32e122a63 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_locationbasedperformancetier_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_locationbasedperformancetier_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,19 +16,30 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PerformanceTiersListByLocation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PerformanceTiersListByLocation.json func ExampleLocationBasedPerformanceTierClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewLocationBasedPerformanceTierClient("", cred, nil) - res, err := client.List(ctx, - "", - nil) + client, err := armmariadb.NewLocationBasedPerformanceTierClient("", cred, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List("", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.LocationBasedPerformanceTierClientListResult) } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_locationbasedrecommendedactionsessionsoperationstatus_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_locationbasedrecommendedactionsessionsoperationstatus_client_test.go index 526004e53b5e..11991af03d75 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_locationbasedrecommendedactionsessionsoperationstatus_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_locationbasedrecommendedactionsessionsoperationstatus_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,20 +16,27 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/RecommendedActionSessionOperationStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/RecommendedActionSessionOperationStatus.json func ExampleLocationBasedRecommendedActionSessionsOperationStatusClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewLocationBasedRecommendedActionSessionsOperationStatusClient("", cred, nil) + client, err := armmariadb.NewLocationBasedRecommendedActionSessionsOperationStatusClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.LocationBasedRecommendedActionSessionsOperationStatusClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_locationbasedrecommendedactionsessionsresult_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_locationbasedrecommendedactionsessionsresult_client_test.go index c98ddf66aeed..c1f8872f2199 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_locationbasedrecommendedactionsessionsresult_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_locationbasedrecommendedactionsessionsresult_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,27 +16,31 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/RecommendedActionSessionResult.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/RecommendedActionSessionResult.json func ExampleLocationBasedRecommendedActionSessionsResultClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewLocationBasedRecommendedActionSessionsResultClient("", cred, nil) + client, err := armmariadb.NewLocationBasedRecommendedActionSessionsResultClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_logfiles_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_logfiles_client_test.go index fa584de8d066..fbbe091b9ec7 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_logfiles_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_logfiles_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,20 +16,31 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/LogFileListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/LogFileListByServer.json func ExampleLogFilesClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewLogFilesClient("", cred, nil) - res, err := client.ListByServer(ctx, - "", + client, err := armmariadb.NewLogFilesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.ListByServer("", "", nil) - if err != nil { - log.Fatal(err) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.LogFilesClientListByServerResult) } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_mariadbmanagementclient_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_mariadbmanagementclient_client_test.go index ec8bfa3b65b6..7170c5254327 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_mariadbmanagementclient_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_mariadbmanagementclient_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -18,43 +18,57 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/QueryPerformanceInsightResetData.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/QueryPerformanceInsightResetData.json func ExampleManagementClient_ResetQueryPerformanceInsightData() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewManagementClient("", cred, nil) + client, err := armmariadb.NewManagementClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ResetQueryPerformanceInsightData(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ManagementClientResetQueryPerformanceInsightDataResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/RecommendedActionSessionCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/RecommendedActionSessionCreate.json func ExampleManagementClient_BeginCreateRecommendedActionSession() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewManagementClient("", cred, nil) + client, err := armmariadb.NewManagementClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateRecommendedActionSession(ctx, "", "", "", "", - nil) + &armmariadb.ManagementClientBeginCreateRecommendedActionSessionOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_operations_client_test.go index 19c536f4b850..2fce57cf7d1f 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_operations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,18 +16,25 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/OperationList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/OperationList.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewOperationsClient(cred, nil) + client, err := armmariadb.NewOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.OperationsClientListResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_privateendpointconnections_client_test.go index cc0e6c81b598..51592dd7477a 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_privateendpointconnections_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_privateendpointconnections_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,33 +19,45 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewPrivateEndpointConnectionsClient("", cred, nil) + client, err := armmariadb.NewPrivateEndpointConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateEndpointConnectionUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateEndpointConnectionUpdate.json func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewPrivateEndpointConnectionsClient("", cred, nil) + client, err := armmariadb.NewPrivateEndpointConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "", "", @@ -53,94 +65,116 @@ func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { armmariadb.PrivateEndpointConnection{ Properties: &armmariadb.PrivateEndpointConnectionProperties{ PrivateLinkServiceConnectionState: &armmariadb.PrivateLinkServiceConnectionStateProperty{ - Description: to.StringPtr(""), - Status: to.StringPtr(""), + Description: to.Ptr(""), + Status: to.Ptr(""), }, }, }, - nil) + &armmariadb.PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateEndpointConnectionDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateEndpointConnectionDelete.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewPrivateEndpointConnectionsClient("", cred, nil) + client, err := armmariadb.NewPrivateEndpointConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "", "", "", - nil) + &armmariadb.PrivateEndpointConnectionsClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateEndpointConnectionUpdateTags.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateEndpointConnectionUpdateTags.json func ExamplePrivateEndpointConnectionsClient_BeginUpdateTags() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewPrivateEndpointConnectionsClient("", cred, nil) + client, err := armmariadb.NewPrivateEndpointConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginUpdateTags(ctx, "", "", "", armmariadb.TagsObject{ Tags: map[string]*string{ - "key1": to.StringPtr("val1"), - "key2": to.StringPtr("val2"), + "key1": to.Ptr("val1"), + "key2": to.Ptr("val2"), }, }, - nil) + &armmariadb.PrivateEndpointConnectionsClientBeginUpdateTagsOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientUpdateTagsResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateEndpointConnectionList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateEndpointConnectionList.json func ExamplePrivateEndpointConnectionsClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewPrivateEndpointConnectionsClient("", cred, nil) + client, err := armmariadb.NewPrivateEndpointConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByServer("", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_privatelinkresources_client_test.go index 48639b35df27..00c94a2ff691 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_privatelinkresources_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_privatelinkresources_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,46 +16,57 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateLinkResourcesList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateLinkResourcesList.json func ExamplePrivateLinkResourcesClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewPrivateLinkResourcesClient("", cred, nil) + client, err := armmariadb.NewPrivateLinkResourcesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByServer("", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateLinkResourcesGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PrivateLinkResourcesGet.json func ExamplePrivateLinkResourcesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewPrivateLinkResourcesClient("", cred, nil) + client, err := armmariadb.NewPrivateLinkResourcesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateLinkResourcesClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_querytexts_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_querytexts_client_test.go index df2ceefb6e8f..8c2a4d9e9c0b 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_querytexts_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_querytexts_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,49 +16,60 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/QueryTextsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/QueryTextsGet.json func ExampleQueryTextsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewQueryTextsClient("", cred, nil) + client, err := armmariadb.NewQueryTextsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.QueryTextsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/QueryTextsListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/QueryTextsListByServer.json func ExampleQueryTextsClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewQueryTextsClient("", cred, nil) + client, err := armmariadb.NewQueryTextsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByServer("", "", []string{ "1", "2"}, nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_recommendedactions_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_recommendedactions_client_test.go index ed14942c37d1..a747ed761f18 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_recommendedactions_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_recommendedactions_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,14 +16,19 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/RecommendedActionsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/RecommendedActionsGet.json func ExampleRecommendedActionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewRecommendedActionsClient("", cred, nil) + client, err := armmariadb.NewRecommendedActionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", @@ -31,33 +36,39 @@ func ExampleRecommendedActionsClient_Get() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.RecommendedActionsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/RecommendedActionsListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/RecommendedActionsListByServer.json func ExampleRecommendedActionsClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewRecommendedActionsClient("", cred, nil) + client, err := armmariadb.NewRecommendedActionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByServer("", "", "", &armmariadb.RecommendedActionsClientListByServerOptions{SessionID: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_recoverableservers_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_recoverableservers_client_test.go index e0fd7261d07a..65cb6b72df1c 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_recoverableservers_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_recoverableservers_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,20 +16,27 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/RecoverableServersGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/RecoverableServersGet.json func ExampleRecoverableServersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewRecoverableServersClient("", cred, nil) + client, err := armmariadb.NewRecoverableServersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.RecoverableServersClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_replicas_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_replicas_client_test.go index 3227122d5ae6..09fd16a25db2 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_replicas_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_replicas_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,20 +16,31 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ReplicasListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ReplicasListByServer.json func ExampleReplicasClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewReplicasClient("", cred, nil) - res, err := client.ListByServer(ctx, - "", + client, err := armmariadb.NewReplicasClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.ListByServer("", "", nil) - if err != nil { - log.Fatal(err) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.ReplicasClientListByServerResult) } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_serverbasedperformancetier_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_serverbasedperformancetier_client_test.go index e1c49c00e86b..e0d8dea535a3 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_serverbasedperformancetier_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_serverbasedperformancetier_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,20 +16,31 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PerformanceTiersListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/PerformanceTiersListByServer.json func ExampleServerBasedPerformanceTierClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServerBasedPerformanceTierClient("", cred, nil) - res, err := client.List(ctx, - "", + client, err := armmariadb.NewServerBasedPerformanceTierClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List("", "", nil) - if err != nil { - log.Fatal(err) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.ServerBasedPerformanceTierClientListResult) } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_serverparameters_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_serverparameters_client_test.go index 9dea52bd96d1..23bc5ceb1af5 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_serverparameters_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_serverparameters_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -18,25 +18,33 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ConfigurationsUpdateByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ConfigurationsUpdateByServer.json func ExampleServerParametersClient_BeginListUpdateConfigurations() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServerParametersClient("", cred, nil) + client, err := armmariadb.NewServerParametersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginListUpdateConfigurations(ctx, "", "", armmariadb.ConfigurationListResult{}, - nil) + &armmariadb.ServerParametersClientBeginListUpdateConfigurationsOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.ServerParametersClientListUpdateConfigurationsResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_servers_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_servers_client_test.go index beb722432719..4c12e401e9dc 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_servers_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_servers_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,204 +19,277 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerCreatePointInTimeRestore.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerCreatePointInTimeRestore.json func ExampleServersClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServersClient("", cred, nil) + client, err := armmariadb.NewServersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreate(ctx, "", "", armmariadb.ServerForCreate{ - Location: to.StringPtr(""), + Location: to.Ptr(""), Properties: &armmariadb.ServerPropertiesForRestore{ - CreateMode: armmariadb.CreateMode("PointInTimeRestore").ToPtr(), - RestorePointInTime: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-14T00:00:37.467Z"); return t }()), - SourceServerID: to.StringPtr(""), + CreateMode: to.Ptr(armmariadb.CreateModePointInTimeRestore), + RestorePointInTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-14T00:00:37.467Z"); return t }()), + SourceServerID: to.Ptr(""), }, SKU: &armmariadb.SKU{ - Name: to.StringPtr(""), - Capacity: to.Int32Ptr(2), - Family: to.StringPtr(""), - Tier: armmariadb.SKUTier("GeneralPurpose").ToPtr(), + Name: to.Ptr(""), + Capacity: to.Ptr[int32](2), + Family: to.Ptr(""), + Tier: to.Ptr(armmariadb.SKUTierGeneralPurpose), }, Tags: map[string]*string{ - "ElasticServer": to.StringPtr("1"), + "ElasticServer": to.Ptr("1"), }, }, - nil) + &armmariadb.ServersClientBeginCreateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.ServersClientCreateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerUpdate.json func ExampleServersClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServersClient("", cred, nil) + client, err := armmariadb.NewServersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginUpdate(ctx, "", "", armmariadb.ServerUpdateParameters{ Properties: &armmariadb.ServerUpdateParametersProperties{ - AdministratorLoginPassword: to.StringPtr(""), - SSLEnforcement: armmariadb.SSLEnforcementEnumDisabled.ToPtr(), + AdministratorLoginPassword: to.Ptr(""), + SSLEnforcement: to.Ptr(armmariadb.SSLEnforcementEnumDisabled), }, }, - nil) + &armmariadb.ServersClientBeginUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.ServersClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerDelete.json func ExampleServersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServersClient("", cred, nil) + client, err := armmariadb.NewServersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "", "", - nil) + &armmariadb.ServersClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerGet.json func ExampleServersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServersClient("", cred, nil) + client, err := armmariadb.NewServersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ServersClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerListByResourceGroup.json func ExampleServersClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServersClient("", cred, nil) - res, err := client.ListByResourceGroup(ctx, - "", - nil) + client, err := armmariadb.NewServersClient("", cred, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.ListByResourceGroup("", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.ServersClientListByResourceGroupResult) } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerList.json func ExampleServersClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServersClient("", cred, nil) - res, err := client.List(ctx, - nil) + client, err := armmariadb.NewServersClient("", cred, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.ServersClientListResult) } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerRestart.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerRestart.json func ExampleServersClient_BeginRestart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServersClient("", cred, nil) + client, err := armmariadb.NewServersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginRestart(ctx, "", "", - nil) + &armmariadb.ServersClientBeginRestartOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2020-01-01/examples/ServerStart.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2020-01-01/examples/ServerStart.json func ExampleServersClient_BeginStart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServersClient("", cred, nil) + client, err := armmariadb.NewServersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginStart(ctx, "", "", - nil) + &armmariadb.ServersClientBeginStartOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2020-01-01/examples/ServerStop.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2020-01-01/examples/ServerStop.json func ExampleServersClient_BeginStop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServersClient("", cred, nil) + client, err := armmariadb.NewServersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginStop(ctx, "", "", - nil) + &armmariadb.ServersClientBeginStopOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_serversecurityalertpolicies_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_serversecurityalertpolicies_client_test.go index 043d45f672f4..af1d0cc727f3 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_serversecurityalertpolicies_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_serversecurityalertpolicies_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,83 +19,102 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerSecurityAlertsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerSecurityAlertsGet.json func ExampleServerSecurityAlertPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServerSecurityAlertPoliciesClient("", cred, nil) + client, err := armmariadb.NewServerSecurityAlertPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", - armmariadb.SecurityAlertPolicyName("Default"), + armmariadb.SecurityAlertPolicyNameDefault, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ServerSecurityAlertPoliciesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerSecurityAlertsCreateMax.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerSecurityAlertsCreateMax.json func ExampleServerSecurityAlertPoliciesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServerSecurityAlertPoliciesClient("", cred, nil) + client, err := armmariadb.NewServerSecurityAlertPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "", "", - armmariadb.SecurityAlertPolicyName("Default"), + armmariadb.SecurityAlertPolicyNameDefault, armmariadb.ServerSecurityAlertPolicy{ Properties: &armmariadb.SecurityAlertPolicyProperties{ DisabledAlerts: []*string{ - to.StringPtr("Access_Anomaly"), - to.StringPtr("Usage_Anomaly")}, - EmailAccountAdmins: to.BoolPtr(true), + to.Ptr("Access_Anomaly"), + to.Ptr("Usage_Anomaly")}, + EmailAccountAdmins: to.Ptr(true), EmailAddresses: []*string{ - to.StringPtr("testSecurityAlert@microsoft.com")}, - RetentionDays: to.Int32Ptr(5), - State: armmariadb.ServerSecurityAlertPolicyStateEnabled.ToPtr(), - StorageAccountAccessKey: to.StringPtr(""), - StorageEndpoint: to.StringPtr(""), + to.Ptr("testSecurityAlert@microsoft.com")}, + RetentionDays: to.Ptr[int32](5), + State: to.Ptr(armmariadb.ServerSecurityAlertPolicyStateEnabled), + StorageAccountAccessKey: to.Ptr(""), + StorageEndpoint: to.Ptr(""), }, }, - nil) + &armmariadb.ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.ServerSecurityAlertPoliciesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerSecurityAlertsListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ServerSecurityAlertsListByServer.json func ExampleServerSecurityAlertPoliciesClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewServerSecurityAlertPoliciesClient("", cred, nil) + client, err := armmariadb.NewServerSecurityAlertPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByServer("", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_topquerystatistics_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_topquerystatistics_client_test.go index 84887d816d39..37b22720eeed 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_topquerystatistics_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_topquerystatistics_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,56 +19,67 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/TopQueryStatisticsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/TopQueryStatisticsGet.json func ExampleTopQueryStatisticsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewTopQueryStatisticsClient("", cred, nil) + client, err := armmariadb.NewTopQueryStatisticsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.TopQueryStatisticsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/TopQueryStatisticsListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/TopQueryStatisticsListByServer.json func ExampleTopQueryStatisticsClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewTopQueryStatisticsClient("", cred, nil) + client, err := armmariadb.NewTopQueryStatisticsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByServer("", "", armmariadb.TopQueryStatisticsInput{ Properties: &armmariadb.TopQueryStatisticsInputProperties{ - AggregationFunction: to.StringPtr(""), - AggregationWindow: to.StringPtr(""), - NumberOfTopQueries: to.Int32Ptr(5), - ObservationEndTime: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T20:00:00.000Z"); return t }()), - ObservationStartTime: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T20:00:00.000Z"); return t }()), - ObservedMetric: to.StringPtr(""), + AggregationFunction: to.Ptr(""), + AggregationWindow: to.Ptr(""), + NumberOfTopQueries: to.Ptr[int32](5), + ObservationEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T20:00:00.000Z"); return t }()), + ObservationStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T20:00:00.000Z"); return t }()), + ObservedMetric: to.Ptr(""), }, }, nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_virtualnetworkrules_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_virtualnetworkrules_client_test.go index 81ea8b92e353..c677381b5114 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_virtualnetworkrules_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_virtualnetworkrules_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,97 +19,123 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/VirtualNetworkRulesGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/VirtualNetworkRulesGet.json func ExampleVirtualNetworkRulesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewVirtualNetworkRulesClient("", cred, nil) + client, err := armmariadb.NewVirtualNetworkRulesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VirtualNetworkRulesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/VirtualNetworkRulesCreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/VirtualNetworkRulesCreateOrUpdate.json func ExampleVirtualNetworkRulesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewVirtualNetworkRulesClient("", cred, nil) + client, err := armmariadb.NewVirtualNetworkRulesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "", "", "", armmariadb.VirtualNetworkRule{ Properties: &armmariadb.VirtualNetworkRuleProperties{ - IgnoreMissingVnetServiceEndpoint: to.BoolPtr(false), - VirtualNetworkSubnetID: to.StringPtr(""), + IgnoreMissingVnetServiceEndpoint: to.Ptr(false), + VirtualNetworkSubnetID: to.Ptr(""), }, }, - nil) + &armmariadb.VirtualNetworkRulesClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.VirtualNetworkRulesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/VirtualNetworkRulesDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/VirtualNetworkRulesDelete.json func ExampleVirtualNetworkRulesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewVirtualNetworkRulesClient("", cred, nil) + client, err := armmariadb.NewVirtualNetworkRulesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "", "", "", - nil) + &armmariadb.VirtualNetworkRulesClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/VirtualNetworkRulesList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/VirtualNetworkRulesList.json func ExampleVirtualNetworkRulesClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewVirtualNetworkRulesClient("", cred, nil) + client, err := armmariadb.NewVirtualNetworkRulesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByServer("", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_waitstatistics_client_test.go b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_waitstatistics_client_test.go index 641667da1d9a..072c05781705 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_waitstatistics_client_test.go +++ b/sdk/resourcemanager/mariadb/armmariadb/ze_generated_example_waitstatistics_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,53 +19,64 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mariadb/armmariadb" ) -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/WaitStatisticsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/WaitStatisticsGet.json func ExampleWaitStatisticsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewWaitStatisticsClient("", cred, nil) + client, err := armmariadb.NewWaitStatisticsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.WaitStatisticsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/WaitStatisticsListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/WaitStatisticsListByServer.json func ExampleWaitStatisticsClient_ListByServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmariadb.NewWaitStatisticsClient("", cred, nil) + client, err := armmariadb.NewWaitStatisticsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByServer("", "", armmariadb.WaitStatisticsInput{ Properties: &armmariadb.WaitStatisticsInputProperties{ - AggregationWindow: to.StringPtr(""), - ObservationEndTime: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T20:00:00.000Z"); return t }()), - ObservationStartTime: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T20:00:00.000Z"); return t }()), + AggregationWindow: to.Ptr(""), + ObservationEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T20:00:00.000Z"); return t }()), + ObservationStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T20:00:00.000Z"); return t }()), }, }, nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_advisors_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_advisors_client.go index 76d241b78918..012d61d85c1b 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_advisors_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_advisors_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type AdvisorsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewAdvisorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AdvisorsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewAdvisorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AdvisorsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &AdvisorsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get a recommendation action advisor. @@ -102,7 +107,7 @@ func (client *AdvisorsClient) getCreateRequest(ctx context.Context, resourceGrou // getHandleResponse handles the Get response. func (client *AdvisorsClient) getHandleResponse(resp *http.Response) (AdvisorsClientGetResponse, error) { - result := AdvisorsClientGetResponse{RawResponse: resp} + result := AdvisorsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Advisor); err != nil { return AdvisorsClientGetResponse{}, err } @@ -114,16 +119,32 @@ func (client *AdvisorsClient) getHandleResponse(resp *http.Response) (AdvisorsCl // resourceGroupName - The name of the resource group. The name is case insensitive. // serverName - The name of the server. // options - AdvisorsClientListByServerOptions contains the optional parameters for the AdvisorsClient.ListByServer method. -func (client *AdvisorsClient) ListByServer(resourceGroupName string, serverName string, options *AdvisorsClientListByServerOptions) *AdvisorsClientListByServerPager { - return &AdvisorsClientListByServerPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) +func (client *AdvisorsClient) ListByServer(resourceGroupName string, serverName string, options *AdvisorsClientListByServerOptions) *runtime.Pager[AdvisorsClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[AdvisorsClientListByServerResponse]{ + More: func(page AdvisorsClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp AdvisorsClientListByServerResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.AdvisorsResultList.NextLink) + Fetcher: func(ctx context.Context, page *AdvisorsClientListByServerResponse) (AdvisorsClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AdvisorsClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AdvisorsClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AdvisorsClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) }, - } + }) } // listByServerCreateRequest creates the ListByServer request. @@ -154,7 +175,7 @@ func (client *AdvisorsClient) listByServerCreateRequest(ctx context.Context, res // listByServerHandleResponse handles the ListByServer response. func (client *AdvisorsClient) listByServerHandleResponse(resp *http.Response) (AdvisorsClientListByServerResponse, error) { - result := AdvisorsClientListByServerResponse{RawResponse: resp} + result := AdvisorsClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AdvisorsResultList); err != nil { return AdvisorsClientListByServerResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_checknameavailability_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_checknameavailability_client.go index 22229cd24cb0..71720e1b34be 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_checknameavailability_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_checknameavailability_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type CheckNameAvailabilityClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CheckNameAvailabilityClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CheckNameAvailabilityClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &CheckNameAvailabilityClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Execute - Check the availability of name for resource @@ -89,7 +94,7 @@ func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Cont // executeHandleResponse handles the Execute response. func (client *CheckNameAvailabilityClient) executeHandleResponse(resp *http.Response) (CheckNameAvailabilityClientExecuteResponse, error) { - result := CheckNameAvailabilityClientExecuteResponse{RawResponse: resp} + result := CheckNameAvailabilityClientExecuteResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { return CheckNameAvailabilityClientExecuteResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_configurations_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_configurations_client.go index 8673d5161076..fe2ac7adeec8 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_configurations_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_configurations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ConfigurationsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConfigurationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ConfigurationsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Updates a configuration of a server. @@ -57,22 +62,16 @@ func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCrede // parameters - The required parameters for updating a server configuration. // options - ConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginCreateOrUpdate // method. -func (client *ConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginCreateOrUpdateOptions) (ConfigurationsClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, configurationName, parameters, options) - if err != nil { - return ConfigurationsClientCreateOrUpdatePollerResponse{}, err - } - result := ConfigurationsClientCreateOrUpdatePollerResponse{ - RawResponse: resp, +func (client *ConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*armruntime.Poller[ConfigurationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, configurationName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ConfigurationsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ConfigurationsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("ConfigurationsClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return ConfigurationsClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &ConfigurationsClientCreateOrUpdatePoller{ - pt: pt, - } - return result, nil } // CreateOrUpdate - Updates a configuration of a server. @@ -175,7 +174,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour // getHandleResponse handles the Get response. func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (ConfigurationsClientGetResponse, error) { - result := ConfigurationsClientGetResponse{RawResponse: resp} + result := ConfigurationsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Configuration); err != nil { return ConfigurationsClientGetResponse{}, err } @@ -188,19 +187,26 @@ func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (Conf // serverName - The name of the server. // options - ConfigurationsClientListByServerOptions contains the optional parameters for the ConfigurationsClient.ListByServer // method. -func (client *ConfigurationsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, options *ConfigurationsClientListByServerOptions) (ConfigurationsClientListByServerResponse, error) { - req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) - if err != nil { - return ConfigurationsClientListByServerResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ConfigurationsClientListByServerResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConfigurationsClientListByServerResponse{}, runtime.NewResponseError(resp) - } - return client.listByServerHandleResponse(resp) +func (client *ConfigurationsClient) ListByServer(resourceGroupName string, serverName string, options *ConfigurationsClientListByServerOptions) *runtime.Pager[ConfigurationsClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[ConfigurationsClientListByServerResponse]{ + More: func(page ConfigurationsClientListByServerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ConfigurationsClientListByServerResponse) (ConfigurationsClientListByServerResponse, error) { + req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + if err != nil { + return ConfigurationsClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConfigurationsClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConfigurationsClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) + }, + }) } // listByServerCreateRequest creates the ListByServer request. @@ -231,7 +237,7 @@ func (client *ConfigurationsClient) listByServerCreateRequest(ctx context.Contex // listByServerHandleResponse handles the ListByServer response. func (client *ConfigurationsClient) listByServerHandleResponse(resp *http.Response) (ConfigurationsClientListByServerResponse, error) { - result := ConfigurationsClientListByServerResponse{RawResponse: resp} + result := ConfigurationsClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationListResult); err != nil { return ConfigurationsClientListByServerResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_constants.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_constants.go index d72ffc58c814..02e23bbe8383 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_constants.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armmariadb const ( moduleName = "armmariadb" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // CreateMode - The mode to create a new server. @@ -33,11 +33,6 @@ func PossibleCreateModeValues() []CreateMode { } } -// ToPtr returns a *CreateMode pointing to the current value. -func (c CreateMode) ToPtr() *CreateMode { - return &c -} - // GeoRedundantBackup - Enable Geo-redundant or not for server backup. type GeoRedundantBackup string @@ -54,11 +49,6 @@ func PossibleGeoRedundantBackupValues() []GeoRedundantBackup { } } -// ToPtr returns a *GeoRedundantBackup pointing to the current value. -func (c GeoRedundantBackup) ToPtr() *GeoRedundantBackup { - return &c -} - // MinimalTLSVersionEnum - Enforce a minimal Tls version for the server. type MinimalTLSVersionEnum string @@ -79,11 +69,6 @@ func PossibleMinimalTLSVersionEnumValues() []MinimalTLSVersionEnum { } } -// ToPtr returns a *MinimalTLSVersionEnum pointing to the current value. -func (c MinimalTLSVersionEnum) ToPtr() *MinimalTLSVersionEnum { - return &c -} - // OperationOrigin - The intended executor of the operation. type OperationOrigin string @@ -102,11 +87,6 @@ func PossibleOperationOriginValues() []OperationOrigin { } } -// ToPtr returns a *OperationOrigin pointing to the current value. -func (c OperationOrigin) ToPtr() *OperationOrigin { - return &c -} - // PrivateEndpointProvisioningState - State of the private endpoint connection. type PrivateEndpointProvisioningState string @@ -129,11 +109,6 @@ func PossiblePrivateEndpointProvisioningStateValues() []PrivateEndpointProvision } } -// ToPtr returns a *PrivateEndpointProvisioningState pointing to the current value. -func (c PrivateEndpointProvisioningState) ToPtr() *PrivateEndpointProvisioningState { - return &c -} - // PrivateLinkServiceConnectionStateActionsRequire - The actions required for private link service connection. type PrivateLinkServiceConnectionStateActionsRequire string @@ -148,11 +123,6 @@ func PossiblePrivateLinkServiceConnectionStateActionsRequireValues() []PrivateLi } } -// ToPtr returns a *PrivateLinkServiceConnectionStateActionsRequire pointing to the current value. -func (c PrivateLinkServiceConnectionStateActionsRequire) ToPtr() *PrivateLinkServiceConnectionStateActionsRequire { - return &c -} - // PrivateLinkServiceConnectionStateStatus - The private link service connection status. type PrivateLinkServiceConnectionStateStatus string @@ -173,11 +143,6 @@ func PossiblePrivateLinkServiceConnectionStateStatusValues() []PrivateLinkServic } } -// ToPtr returns a *PrivateLinkServiceConnectionStateStatus pointing to the current value. -func (c PrivateLinkServiceConnectionStateStatus) ToPtr() *PrivateLinkServiceConnectionStateStatus { - return &c -} - // PublicNetworkAccessEnum - Whether or not public network access is allowed for this server. Value is optional but if passed // in, must be 'Enabled' or 'Disabled' type PublicNetworkAccessEnum string @@ -195,11 +160,6 @@ func PossiblePublicNetworkAccessEnumValues() []PublicNetworkAccessEnum { } } -// ToPtr returns a *PublicNetworkAccessEnum pointing to the current value. -func (c PublicNetworkAccessEnum) ToPtr() *PublicNetworkAccessEnum { - return &c -} - // QueryPerformanceInsightResetDataResultState - Indicates result of the operation. type QueryPerformanceInsightResetDataResultState string @@ -216,11 +176,6 @@ func PossibleQueryPerformanceInsightResetDataResultStateValues() []QueryPerforma } } -// ToPtr returns a *QueryPerformanceInsightResetDataResultState pointing to the current value. -func (c QueryPerformanceInsightResetDataResultState) ToPtr() *QueryPerformanceInsightResetDataResultState { - return &c -} - // SKUTier - The tier of the particular SKU, e.g. Basic. type SKUTier string @@ -239,11 +194,6 @@ func PossibleSKUTierValues() []SKUTier { } } -// ToPtr returns a *SKUTier pointing to the current value. -func (c SKUTier) ToPtr() *SKUTier { - return &c -} - // SSLEnforcementEnum - Enable ssl enforcement or not when connect to server. type SSLEnforcementEnum string @@ -260,11 +210,6 @@ func PossibleSSLEnforcementEnumValues() []SSLEnforcementEnum { } } -// ToPtr returns a *SSLEnforcementEnum pointing to the current value. -func (c SSLEnforcementEnum) ToPtr() *SSLEnforcementEnum { - return &c -} - type SecurityAlertPolicyName string const ( @@ -278,11 +223,6 @@ func PossibleSecurityAlertPolicyNameValues() []SecurityAlertPolicyName { } } -// ToPtr returns a *SecurityAlertPolicyName pointing to the current value. -func (c SecurityAlertPolicyName) ToPtr() *SecurityAlertPolicyName { - return &c -} - // ServerSecurityAlertPolicyState - Specifies the state of the policy, whether it is enabled or disabled. type ServerSecurityAlertPolicyState string @@ -299,11 +239,6 @@ func PossibleServerSecurityAlertPolicyStateValues() []ServerSecurityAlertPolicyS } } -// ToPtr returns a *ServerSecurityAlertPolicyState pointing to the current value. -func (c ServerSecurityAlertPolicyState) ToPtr() *ServerSecurityAlertPolicyState { - return &c -} - // ServerState - A state of a server that is visible to user. type ServerState string @@ -322,11 +257,6 @@ func PossibleServerStateValues() []ServerState { } } -// ToPtr returns a *ServerState pointing to the current value. -func (c ServerState) ToPtr() *ServerState { - return &c -} - // ServerVersion - The version of a server. type ServerVersion string @@ -343,11 +273,6 @@ func PossibleServerVersionValues() []ServerVersion { } } -// ToPtr returns a *ServerVersion pointing to the current value. -func (c ServerVersion) ToPtr() *ServerVersion { - return &c -} - // StorageAutogrow - Enable Storage Auto Grow. type StorageAutogrow string @@ -364,11 +289,6 @@ func PossibleStorageAutogrowValues() []StorageAutogrow { } } -// ToPtr returns a *StorageAutogrow pointing to the current value. -func (c StorageAutogrow) ToPtr() *StorageAutogrow { - return &c -} - // VirtualNetworkRuleState - Virtual Network Rule State type VirtualNetworkRuleState string @@ -390,8 +310,3 @@ func PossibleVirtualNetworkRuleStateValues() []VirtualNetworkRuleState { VirtualNetworkRuleStateUnknown, } } - -// ToPtr returns a *VirtualNetworkRuleState pointing to the current value. -func (c VirtualNetworkRuleState) ToPtr() *VirtualNetworkRuleState { - return &c -} diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_databases_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_databases_client.go index b2cc902183b8..fb25aea147df 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_databases_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_databases_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type DatabasesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabasesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DatabasesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &DatabasesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Creates a new database or updates an existing database. @@ -57,22 +62,16 @@ func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential // parameters - The required parameters for creating or updating a database. // options - DatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasesClient.BeginCreateOrUpdate // method. -func (client *DatabasesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database, options *DatabasesClientBeginCreateOrUpdateOptions) (DatabasesClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, databaseName, parameters, options) - if err != nil { - return DatabasesClientCreateOrUpdatePollerResponse{}, err - } - result := DatabasesClientCreateOrUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("DatabasesClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return DatabasesClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &DatabasesClientCreateOrUpdatePoller{ - pt: pt, +func (client *DatabasesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database, options *DatabasesClientBeginCreateOrUpdateOptions) (*armruntime.Poller[DatabasesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, databaseName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[DatabasesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[DatabasesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // CreateOrUpdate - Creates a new database or updates an existing database. @@ -128,22 +127,16 @@ func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, // serverName - The name of the server. // databaseName - The name of the database. // options - DatabasesClientBeginDeleteOptions contains the optional parameters for the DatabasesClient.BeginDelete method. -func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (DatabasesClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, databaseName, options) - if err != nil { - return DatabasesClientDeletePollerResponse{}, err - } - result := DatabasesClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("DatabasesClient.Delete", "", resp, client.pl) - if err != nil { - return DatabasesClientDeletePollerResponse{}, err - } - result.Poller = &DatabasesClientDeletePoller{ - pt: pt, +func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (*armruntime.Poller[DatabasesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, databaseName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[DatabasesClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[DatabasesClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - Deletes a database. @@ -246,7 +239,7 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro // getHandleResponse handles the Get response. func (client *DatabasesClient) getHandleResponse(resp *http.Response) (DatabasesClientGetResponse, error) { - result := DatabasesClientGetResponse{RawResponse: resp} + result := DatabasesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Database); err != nil { return DatabasesClientGetResponse{}, err } @@ -258,19 +251,26 @@ func (client *DatabasesClient) getHandleResponse(resp *http.Response) (Databases // resourceGroupName - The name of the resource group. The name is case insensitive. // serverName - The name of the server. // options - DatabasesClientListByServerOptions contains the optional parameters for the DatabasesClient.ListByServer method. -func (client *DatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, options *DatabasesClientListByServerOptions) (DatabasesClientListByServerResponse, error) { - req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) - if err != nil { - return DatabasesClientListByServerResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DatabasesClientListByServerResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientListByServerResponse{}, runtime.NewResponseError(resp) - } - return client.listByServerHandleResponse(resp) +func (client *DatabasesClient) ListByServer(resourceGroupName string, serverName string, options *DatabasesClientListByServerOptions) *runtime.Pager[DatabasesClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[DatabasesClientListByServerResponse]{ + More: func(page DatabasesClientListByServerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *DatabasesClientListByServerResponse) (DatabasesClientListByServerResponse, error) { + req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + if err != nil { + return DatabasesClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DatabasesClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DatabasesClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) + }, + }) } // listByServerCreateRequest creates the ListByServer request. @@ -301,7 +301,7 @@ func (client *DatabasesClient) listByServerCreateRequest(ctx context.Context, re // listByServerHandleResponse handles the ListByServer response. func (client *DatabasesClient) listByServerHandleResponse(resp *http.Response) (DatabasesClientListByServerResponse, error) { - result := DatabasesClientListByServerResponse{RawResponse: resp} + result := DatabasesClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseListResult); err != nil { return DatabasesClientListByServerResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_firewallrules_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_firewallrules_client.go index 28bc6f1a8d7c..1581b83643fb 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_firewallrules_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_firewallrules_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type FirewallRulesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallRulesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallRulesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &FirewallRulesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule. @@ -57,22 +62,16 @@ func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCreden // parameters - The required parameters for creating or updating a firewall rule. // options - FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate // method. -func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (FirewallRulesClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, firewallRuleName, parameters, options) - if err != nil { - return FirewallRulesClientCreateOrUpdatePollerResponse{}, err - } - result := FirewallRulesClientCreateOrUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("FirewallRulesClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return FirewallRulesClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &FirewallRulesClientCreateOrUpdatePoller{ - pt: pt, +func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*armruntime.Poller[FirewallRulesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, firewallRuleName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[FirewallRulesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[FirewallRulesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // CreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule. @@ -129,22 +128,16 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte // firewallRuleName - The name of the server firewall rule. // options - FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete // method. -func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (FirewallRulesClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, firewallRuleName, options) - if err != nil { - return FirewallRulesClientDeletePollerResponse{}, err - } - result := FirewallRulesClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("FirewallRulesClient.Delete", "", resp, client.pl) - if err != nil { - return FirewallRulesClientDeletePollerResponse{}, err - } - result.Poller = &FirewallRulesClientDeletePoller{ - pt: pt, +func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*armruntime.Poller[FirewallRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, firewallRuleName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[FirewallRulesClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[FirewallRulesClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - Deletes a server firewall rule. @@ -247,7 +240,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc // getHandleResponse handles the Get response. func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (FirewallRulesClientGetResponse, error) { - result := FirewallRulesClientGetResponse{RawResponse: resp} + result := FirewallRulesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { return FirewallRulesClientGetResponse{}, err } @@ -260,19 +253,26 @@ func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (Firew // serverName - The name of the server. // options - FirewallRulesClientListByServerOptions contains the optional parameters for the FirewallRulesClient.ListByServer // method. -func (client *FirewallRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, options *FirewallRulesClientListByServerOptions) (FirewallRulesClientListByServerResponse, error) { - req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) - if err != nil { - return FirewallRulesClientListByServerResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return FirewallRulesClientListByServerResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FirewallRulesClientListByServerResponse{}, runtime.NewResponseError(resp) - } - return client.listByServerHandleResponse(resp) +func (client *FirewallRulesClient) ListByServer(resourceGroupName string, serverName string, options *FirewallRulesClientListByServerOptions) *runtime.Pager[FirewallRulesClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[FirewallRulesClientListByServerResponse]{ + More: func(page FirewallRulesClientListByServerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *FirewallRulesClientListByServerResponse) (FirewallRulesClientListByServerResponse, error) { + req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + if err != nil { + return FirewallRulesClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallRulesClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallRulesClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) + }, + }) } // listByServerCreateRequest creates the ListByServer request. @@ -303,7 +303,7 @@ func (client *FirewallRulesClient) listByServerCreateRequest(ctx context.Context // listByServerHandleResponse handles the ListByServer response. func (client *FirewallRulesClient) listByServerHandleResponse(resp *http.Response) (FirewallRulesClientListByServerResponse, error) { - result := FirewallRulesClientListByServerResponse{RawResponse: resp} + result := FirewallRulesClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRuleListResult); err != nil { return FirewallRulesClientListByServerResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_locationbasedperformancetier_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_locationbasedperformancetier_client.go index 6edc056e46f1..08393646f43b 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_locationbasedperformancetier_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_locationbasedperformancetier_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type LocationBasedPerformanceTierClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewLocationBasedPerformanceTierClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationBasedPerformanceTierClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewLocationBasedPerformanceTierClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationBasedPerformanceTierClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &LocationBasedPerformanceTierClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - List all the performance tiers at specified location in a given subscription. @@ -54,19 +59,26 @@ func NewLocationBasedPerformanceTierClient(subscriptionID string, credential azc // locationName - The name of the location. // options - LocationBasedPerformanceTierClientListOptions contains the optional parameters for the LocationBasedPerformanceTierClient.List // method. -func (client *LocationBasedPerformanceTierClient) List(ctx context.Context, locationName string, options *LocationBasedPerformanceTierClientListOptions) (LocationBasedPerformanceTierClientListResponse, error) { - req, err := client.listCreateRequest(ctx, locationName, options) - if err != nil { - return LocationBasedPerformanceTierClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return LocationBasedPerformanceTierClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LocationBasedPerformanceTierClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *LocationBasedPerformanceTierClient) List(locationName string, options *LocationBasedPerformanceTierClientListOptions) *runtime.Pager[LocationBasedPerformanceTierClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[LocationBasedPerformanceTierClientListResponse]{ + More: func(page LocationBasedPerformanceTierClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *LocationBasedPerformanceTierClientListResponse) (LocationBasedPerformanceTierClientListResponse, error) { + req, err := client.listCreateRequest(ctx, locationName, options) + if err != nil { + return LocationBasedPerformanceTierClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LocationBasedPerformanceTierClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocationBasedPerformanceTierClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -93,7 +105,7 @@ func (client *LocationBasedPerformanceTierClient) listCreateRequest(ctx context. // listHandleResponse handles the List response. func (client *LocationBasedPerformanceTierClient) listHandleResponse(resp *http.Response) (LocationBasedPerformanceTierClientListResponse, error) { - result := LocationBasedPerformanceTierClientListResponse{RawResponse: resp} + result := LocationBasedPerformanceTierClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PerformanceTierListResult); err != nil { return LocationBasedPerformanceTierClientListResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_locationbasedrecommendedactionsessionsoperationstatus_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_locationbasedrecommendedactionsessionsoperationstatus_client.go index 7cfe152356d7..df13b2ce89ff 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_locationbasedrecommendedactionsessionsoperationstatus_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_locationbasedrecommendedactionsessionsoperationstatus_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type LocationBasedRecommendedActionSessionsOperationStatusClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewLocationBasedRecommendedActionSessionsOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationBasedRecommendedActionSessionsOperationStatusClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewLocationBasedRecommendedActionSessionsOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationBasedRecommendedActionSessionsOperationStatusClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &LocationBasedRecommendedActionSessionsOperationStatusClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Recommendation action session operation status. @@ -98,7 +103,7 @@ func (client *LocationBasedRecommendedActionSessionsOperationStatusClient) getCr // getHandleResponse handles the Get response. func (client *LocationBasedRecommendedActionSessionsOperationStatusClient) getHandleResponse(resp *http.Response) (LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse, error) { - result := LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse{RawResponse: resp} + result := LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendedActionSessionsOperationStatus); err != nil { return LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_locationbasedrecommendedactionsessionsresult_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_locationbasedrecommendedactionsessionsresult_client.go index c1d9667a943c..303173961d24 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_locationbasedrecommendedactionsessionsresult_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_locationbasedrecommendedactionsessionsresult_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type LocationBasedRecommendedActionSessionsResultClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewLocationBasedRecommendedActionSessionsResultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationBasedRecommendedActionSessionsResultClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewLocationBasedRecommendedActionSessionsResultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationBasedRecommendedActionSessionsResultClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &LocationBasedRecommendedActionSessionsResultClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Recommendation action session operation result. @@ -55,16 +60,32 @@ func NewLocationBasedRecommendedActionSessionsResultClient(subscriptionID string // operationID - The operation identifier. // options - LocationBasedRecommendedActionSessionsResultClientListOptions contains the optional parameters for the LocationBasedRecommendedActionSessionsResultClient.List // method. -func (client *LocationBasedRecommendedActionSessionsResultClient) List(locationName string, operationID string, options *LocationBasedRecommendedActionSessionsResultClientListOptions) *LocationBasedRecommendedActionSessionsResultClientListPager { - return &LocationBasedRecommendedActionSessionsResultClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, locationName, operationID, options) +func (client *LocationBasedRecommendedActionSessionsResultClient) List(locationName string, operationID string, options *LocationBasedRecommendedActionSessionsResultClientListOptions) *runtime.Pager[LocationBasedRecommendedActionSessionsResultClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[LocationBasedRecommendedActionSessionsResultClientListResponse]{ + More: func(page LocationBasedRecommendedActionSessionsResultClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp LocationBasedRecommendedActionSessionsResultClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.RecommendationActionsResultList.NextLink) + Fetcher: func(ctx context.Context, page *LocationBasedRecommendedActionSessionsResultClientListResponse) (LocationBasedRecommendedActionSessionsResultClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, locationName, operationID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LocationBasedRecommendedActionSessionsResultClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LocationBasedRecommendedActionSessionsResultClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocationBasedRecommendedActionSessionsResultClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -95,7 +116,7 @@ func (client *LocationBasedRecommendedActionSessionsResultClient) listCreateRequ // listHandleResponse handles the List response. func (client *LocationBasedRecommendedActionSessionsResultClient) listHandleResponse(resp *http.Response) (LocationBasedRecommendedActionSessionsResultClientListResponse, error) { - result := LocationBasedRecommendedActionSessionsResultClientListResponse{RawResponse: resp} + result := LocationBasedRecommendedActionSessionsResultClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendationActionsResultList); err != nil { return LocationBasedRecommendedActionSessionsResultClientListResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_logfiles_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_logfiles_client.go index 6bec94718995..2c05a56f7e63 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_logfiles_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_logfiles_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type LogFilesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewLogFilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LogFilesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewLogFilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LogFilesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &LogFilesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // ListByServer - List all the log files in a given server. @@ -54,19 +59,26 @@ func NewLogFilesClient(subscriptionID string, credential azcore.TokenCredential, // resourceGroupName - The name of the resource group. The name is case insensitive. // serverName - The name of the server. // options - LogFilesClientListByServerOptions contains the optional parameters for the LogFilesClient.ListByServer method. -func (client *LogFilesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, options *LogFilesClientListByServerOptions) (LogFilesClientListByServerResponse, error) { - req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) - if err != nil { - return LogFilesClientListByServerResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return LogFilesClientListByServerResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LogFilesClientListByServerResponse{}, runtime.NewResponseError(resp) - } - return client.listByServerHandleResponse(resp) +func (client *LogFilesClient) ListByServer(resourceGroupName string, serverName string, options *LogFilesClientListByServerOptions) *runtime.Pager[LogFilesClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[LogFilesClientListByServerResponse]{ + More: func(page LogFilesClientListByServerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *LogFilesClientListByServerResponse) (LogFilesClientListByServerResponse, error) { + req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + if err != nil { + return LogFilesClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LogFilesClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LogFilesClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) + }, + }) } // listByServerCreateRequest creates the ListByServer request. @@ -97,7 +109,7 @@ func (client *LogFilesClient) listByServerCreateRequest(ctx context.Context, res // listByServerHandleResponse handles the ListByServer response. func (client *LogFilesClient) listByServerHandleResponse(resp *http.Response) (LogFilesClientListByServerResponse, error) { - result := LogFilesClientListByServerResponse{RawResponse: resp} + result := LogFilesClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.LogFileListResult); err != nil { return LogFilesClientListByServerResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_management_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_management_client.go index 406889fd0bb0..4ae055757682 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_management_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_management_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ManagementClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagementClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagementClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ManagementClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateRecommendedActionSession - Create recommendation action session for the advisor. @@ -57,22 +62,16 @@ func NewManagementClient(subscriptionID string, credential azcore.TokenCredentia // databaseName - The name of the database. // options - ManagementClientBeginCreateRecommendedActionSessionOptions contains the optional parameters for the ManagementClient.BeginCreateRecommendedActionSession // method. -func (client *ManagementClient) BeginCreateRecommendedActionSession(ctx context.Context, resourceGroupName string, serverName string, advisorName string, databaseName string, options *ManagementClientBeginCreateRecommendedActionSessionOptions) (ManagementClientCreateRecommendedActionSessionPollerResponse, error) { - resp, err := client.createRecommendedActionSession(ctx, resourceGroupName, serverName, advisorName, databaseName, options) - if err != nil { - return ManagementClientCreateRecommendedActionSessionPollerResponse{}, err - } - result := ManagementClientCreateRecommendedActionSessionPollerResponse{ - RawResponse: resp, +func (client *ManagementClient) BeginCreateRecommendedActionSession(ctx context.Context, resourceGroupName string, serverName string, advisorName string, databaseName string, options *ManagementClientBeginCreateRecommendedActionSessionOptions) (*armruntime.Poller[ManagementClientCreateRecommendedActionSessionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createRecommendedActionSession(ctx, resourceGroupName, serverName, advisorName, databaseName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ManagementClientCreateRecommendedActionSessionResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ManagementClientCreateRecommendedActionSessionResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("ManagementClient.CreateRecommendedActionSession", "", resp, client.pl) - if err != nil { - return ManagementClientCreateRecommendedActionSessionPollerResponse{}, err - } - result.Poller = &ManagementClientCreateRecommendedActionSessionPoller{ - pt: pt, - } - return result, nil } // CreateRecommendedActionSession - Create recommendation action session for the advisor. @@ -171,7 +170,7 @@ func (client *ManagementClient) resetQueryPerformanceInsightDataCreateRequest(ct // resetQueryPerformanceInsightDataHandleResponse handles the ResetQueryPerformanceInsightData response. func (client *ManagementClient) resetQueryPerformanceInsightDataHandleResponse(resp *http.Response) (ManagementClientResetQueryPerformanceInsightDataResponse, error) { - result := ManagementClientResetQueryPerformanceInsightDataResponse{RawResponse: resp} + result := ManagementClientResetQueryPerformanceInsightDataResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.QueryPerformanceInsightResetDataResult); err != nil { return ManagementClientResetQueryPerformanceInsightDataResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_models.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_models.go index 829afec64e61..33499d6e2871 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_models.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,17 +8,12 @@ package armmariadb -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // Advisor - Represents a recommendation action advisor. type Advisor struct { // The properties of a recommendation action advisor. - Properties map[string]interface{} `json:"properties,omitempty"` + Properties interface{} `json:"properties,omitempty"` // 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"` @@ -49,14 +44,6 @@ type AdvisorsResultList struct { Value []*Advisor `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AdvisorsResultList. -func (a AdvisorsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - // CheckNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityClient.Execute // method. type CheckNameAvailabilityClientExecuteOptions struct { @@ -91,13 +78,6 @@ type ConfigurationListResult struct { Value []*Configuration `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ConfigurationListResult. -func (c ConfigurationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - // ConfigurationProperties - The properties of a configuration. type ConfigurationProperties struct { // Source of the configuration. @@ -122,7 +102,8 @@ type ConfigurationProperties struct { // ConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginCreateOrUpdate // method. type ConfigurationsClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ConfigurationsClientGetOptions contains the optional parameters for the ConfigurationsClient.Get method. @@ -156,13 +137,6 @@ type DatabaseListResult struct { Value []*Database `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type DatabaseListResult. -func (d DatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - // DatabaseProperties - The properties of a database. type DatabaseProperties struct { // The charset of the database. @@ -175,12 +149,14 @@ type DatabaseProperties struct { // DatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasesClient.BeginCreateOrUpdate // method. type DatabasesClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // DatabasesClientBeginDeleteOptions contains the optional parameters for the DatabasesClient.BeginDelete method. type DatabasesClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. @@ -196,7 +172,7 @@ type DatabasesClientListByServerOptions struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info map[string]interface{} `json:"info,omitempty" azure:"ro"` + Info interface{} `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -221,17 +197,6 @@ type ErrorResponse struct { Target *string `json:"target,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) 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) -} - // FirewallRule - Represents a server firewall rule. type FirewallRule struct { // REQUIRED; The properties of a firewall rule. @@ -253,13 +218,6 @@ type FirewallRuleListResult struct { Value []*FirewallRule `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type FirewallRuleListResult. -func (f FirewallRuleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", f.Value) - return json.Marshal(objectMap) -} - // FirewallRuleProperties - The properties of a server firewall rule. type FirewallRuleProperties struct { // REQUIRED; The end IP address of the server firewall rule. Must be IPv4 format. @@ -272,12 +230,14 @@ type FirewallRuleProperties struct { // FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate // method. type FirewallRulesClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete method. type FirewallRulesClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. @@ -329,13 +289,6 @@ type LogFileListResult struct { Value []*LogFile `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type LogFileListResult. -func (l LogFileListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - // LogFileProperties - The properties of a log file. type LogFileProperties struct { // Size of the log file. @@ -354,49 +307,6 @@ type LogFileProperties struct { URL *string `json:"url,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type LogFileProperties. -func (l LogFileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileProperties. -func (l *LogFileProperties) 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 "createdTime": - err = unpopulateTimeRFC3339(val, &l.CreatedTime) - delete(rawMsg, key) - case "lastModifiedTime": - err = unpopulateTimeRFC3339(val, &l.LastModifiedTime) - delete(rawMsg, key) - case "sizeInKB": - err = unpopulate(val, &l.SizeInKB) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &l.Type) - delete(rawMsg, key) - case "url": - err = unpopulate(val, &l.URL) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // LogFilesClientListByServerOptions contains the optional parameters for the LogFilesClient.ListByServer method. type LogFilesClientListByServerOptions struct { // placeholder for future optional parameters @@ -405,7 +315,8 @@ type LogFilesClientListByServerOptions struct { // ManagementClientBeginCreateRecommendedActionSessionOptions contains the optional parameters for the ManagementClient.BeginCreateRecommendedActionSession // method. type ManagementClientBeginCreateRecommendedActionSessionOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ManagementClientResetQueryPerformanceInsightDataOptions contains the optional parameters for the ManagementClient.ResetQueryPerformanceInsightData @@ -447,17 +358,7 @@ type Operation struct { Origin *OperationOrigin `json:"origin,omitempty" azure:"ro"` // READ-ONLY; Additional descriptions for the operation. - Properties map[string]map[string]interface{} `json:"properties,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "display", o.Display) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) - populate(objectMap, "properties", o.Properties) - return json.Marshal(objectMap) + Properties map[string]interface{} `json:"properties,omitempty" azure:"ro"` } // OperationDisplay - Display metadata associated with the operation. @@ -481,13 +382,6 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -499,13 +393,6 @@ type PerformanceTierListResult struct { Value []*PerformanceTierProperties `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PerformanceTierListResult. -func (p PerformanceTierListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PerformanceTierProperties - Performance tier properties type PerformanceTierProperties struct { // ID of the performance tier. @@ -533,20 +420,6 @@ type PerformanceTierProperties struct { ServiceLevelObjectives []*PerformanceTierServiceLevelObjectives `json:"serviceLevelObjectives,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PerformanceTierProperties. -func (p PerformanceTierProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "maxBackupRetentionDays", p.MaxBackupRetentionDays) - populate(objectMap, "maxLargeStorageMB", p.MaxLargeStorageMB) - populate(objectMap, "maxStorageMB", p.MaxStorageMB) - populate(objectMap, "minBackupRetentionDays", p.MinBackupRetentionDays) - populate(objectMap, "minLargeStorageMB", p.MinLargeStorageMB) - populate(objectMap, "minStorageMB", p.MinStorageMB) - populate(objectMap, "serviceLevelObjectives", p.ServiceLevelObjectives) - return json.Marshal(objectMap) -} - // PerformanceTierServiceLevelObjectives - Service level objectives for performance tier. type PerformanceTierServiceLevelObjectives struct { // Edition of the performance tier. @@ -598,14 +471,6 @@ type PrivateEndpointConnectionListResult struct { Value []*PrivateEndpointConnection `json:"value,omitempty" azure:"ro"` } -// 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) - return json.Marshal(objectMap) -} - // PrivateEndpointConnectionProperties - Properties of a private endpoint connection. type PrivateEndpointConnectionProperties struct { // Private endpoint which the connection belongs to. @@ -621,19 +486,22 @@ type PrivateEndpointConnectionProperties struct { // PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate // method. type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // PrivateEndpointConnectionsClientBeginUpdateTagsOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginUpdateTags // method. type PrivateEndpointConnectionsClientBeginUpdateTagsOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get @@ -677,14 +545,6 @@ type PrivateLinkResourceListResult struct { Value []*PrivateLinkResource `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. -func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PrivateLinkResourceProperties - Properties of a private link resource. type PrivateLinkResourceProperties struct { // READ-ONLY; The private link resource group id. @@ -694,14 +554,6 @@ type PrivateLinkResourceProperties struct { RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - return json.Marshal(objectMap) -} - // PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. type PrivateLinkResourcesClientGetOptions struct { // placeholder for future optional parameters @@ -794,69 +646,6 @@ type QueryStatisticProperties struct { StartTime *time.Time `json:"startTime,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type QueryStatisticProperties. -func (q QueryStatisticProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregationFunction", q.AggregationFunction) - populate(objectMap, "databaseNames", q.DatabaseNames) - 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) - populateTimeRFC3339(objectMap, "startTime", q.StartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryStatisticProperties. -func (q *QueryStatisticProperties) 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 "aggregationFunction": - err = unpopulate(val, &q.AggregationFunction) - delete(rawMsg, key) - case "databaseNames": - err = unpopulate(val, &q.DatabaseNames) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, &q.EndTime) - delete(rawMsg, key) - case "metricDisplayName": - err = unpopulate(val, &q.MetricDisplayName) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, &q.MetricName) - delete(rawMsg, key) - case "metricValue": - err = unpopulate(val, &q.MetricValue) - delete(rawMsg, key) - case "metricValueUnit": - err = unpopulate(val, &q.MetricValueUnit) - delete(rawMsg, key) - case "queryExecutionCount": - err = unpopulate(val, &q.QueryExecutionCount) - delete(rawMsg, key) - case "queryId": - err = unpopulate(val, &q.QueryID) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &q.StartTime) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // QueryText - Represents a Query Text. type QueryText struct { // The properties of a query text. @@ -900,14 +689,6 @@ type QueryTextsResultList struct { Value []*QueryText `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type QueryTextsResultList. -func (q QueryTextsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", q.NextLink) - populate(objectMap, "value", q.Value) - return json.Marshal(objectMap) -} - // RecommendationAction - Represents a Recommendation Action. type RecommendationAction struct { // The properties of a recommendation action. @@ -950,61 +731,6 @@ type RecommendationActionProperties struct { SessionID *string `json:"sessionId,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type RecommendationActionProperties. -func (r RecommendationActionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actionId", r.ActionID) - populate(objectMap, "advisorName", r.AdvisorName) - populateTimeRFC3339(objectMap, "createdTime", r.CreatedTime) - populate(objectMap, "details", r.Details) - populateTimeRFC3339(objectMap, "expirationTime", r.ExpirationTime) - populate(objectMap, "reason", r.Reason) - populate(objectMap, "recommendationType", r.RecommendationType) - populate(objectMap, "sessionId", r.SessionID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendationActionProperties. -func (r *RecommendationActionProperties) 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 "actionId": - err = unpopulate(val, &r.ActionID) - delete(rawMsg, key) - case "advisorName": - err = unpopulate(val, &r.AdvisorName) - delete(rawMsg, key) - case "createdTime": - err = unpopulateTimeRFC3339(val, &r.CreatedTime) - delete(rawMsg, key) - case "details": - err = unpopulate(val, &r.Details) - delete(rawMsg, key) - case "expirationTime": - err = unpopulateTimeRFC3339(val, &r.ExpirationTime) - delete(rawMsg, key) - case "reason": - err = unpopulate(val, &r.Reason) - delete(rawMsg, key) - case "recommendationType": - err = unpopulate(val, &r.RecommendationType) - delete(rawMsg, key) - case "sessionId": - err = unpopulate(val, &r.SessionID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // RecommendationActionsResultList - A list of recommendation actions. type RecommendationActionsResultList struct { // READ-ONLY; Link to retrieve next page of results. @@ -1014,14 +740,6 @@ type RecommendationActionsResultList struct { Value []*RecommendationAction `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type RecommendationActionsResultList. -func (r RecommendationActionsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - // RecommendedActionSessionsOperationStatus - Recommendation action session operation status. type RecommendedActionSessionsOperationStatus struct { // Operation identifier. @@ -1034,41 +752,6 @@ type RecommendedActionSessionsOperationStatus struct { Status *string `json:"status,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type RecommendedActionSessionsOperationStatus. -func (r RecommendedActionSessionsOperationStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", r.Name) - populateTimeRFC3339(objectMap, "startTime", r.StartTime) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionSessionsOperationStatus. -func (r *RecommendedActionSessionsOperationStatus) 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 "name": - err = unpopulate(val, &r.Name) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &r.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, &r.Status) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // RecommendedActionsClientGetOptions contains the optional parameters for the RecommendedActionsClient.Get method. type RecommendedActionsClientGetOptions struct { // placeholder for future optional parameters @@ -1182,19 +865,6 @@ type SecurityAlertPolicyProperties struct { StorageEndpoint *string `json:"storageEndpoint,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SecurityAlertPolicyProperties. -func (s SecurityAlertPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "disabledAlerts", s.DisabledAlerts) - populate(objectMap, "emailAccountAdmins", s.EmailAccountAdmins) - populate(objectMap, "emailAddresses", s.EmailAddresses) - populate(objectMap, "retentionDays", s.RetentionDays) - populate(objectMap, "state", s.State) - populate(objectMap, "storageAccountAccessKey", s.StorageAccountAccessKey) - populate(objectMap, "storageEndpoint", s.StorageEndpoint) - return json.Marshal(objectMap) -} - // Server - Represents a server. type Server struct { // REQUIRED; The geo-location where the resource lives @@ -1219,19 +889,6 @@ type Server struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Server. -func (s Server) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "sku", s.SKU) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - // ServerBasedPerformanceTierClientListOptions contains the optional parameters for the ServerBasedPerformanceTierClient.List // method. type ServerBasedPerformanceTierClientListOptions struct { @@ -1253,62 +910,17 @@ type ServerForCreate struct { Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ServerForCreate. -func (s ServerForCreate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "location", s.Location) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "sku", s.SKU) - populate(objectMap, "tags", s.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerForCreate. -func (s *ServerForCreate) 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 "location": - err = unpopulate(val, &s.Location) - delete(rawMsg, key) - case "properties": - s.Properties, err = unmarshalServerPropertiesForCreateClassification(val) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, &s.SKU) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, &s.Tags) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ServerListResult - A list of servers. type ServerListResult struct { // The list of servers Value []*Server `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ServerListResult. -func (s ServerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - // ServerParametersClientBeginListUpdateConfigurationsOptions contains the optional parameters for the ServerParametersClient.BeginListUpdateConfigurations // method. type ServerParametersClientBeginListUpdateConfigurationsOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ServerPrivateEndpointConnection - A private endpoint connection under a server @@ -1387,81 +999,6 @@ type ServerProperties struct { PrivateEndpointConnections []*ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ServerProperties. -func (s ServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "administratorLogin", s.AdministratorLogin) - populateTimeRFC3339(objectMap, "earliestRestoreDate", s.EarliestRestoreDate) - populate(objectMap, "fullyQualifiedDomainName", s.FullyQualifiedDomainName) - populate(objectMap, "masterServerId", s.MasterServerID) - populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) - populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) - populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) - populate(objectMap, "replicaCapacity", s.ReplicaCapacity) - populate(objectMap, "replicationRole", s.ReplicationRole) - populate(objectMap, "sslEnforcement", s.SSLEnforcement) - populate(objectMap, "storageProfile", s.StorageProfile) - populate(objectMap, "userVisibleState", s.UserVisibleState) - populate(objectMap, "version", s.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerProperties. -func (s *ServerProperties) 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 "administratorLogin": - err = unpopulate(val, &s.AdministratorLogin) - delete(rawMsg, key) - case "earliestRestoreDate": - err = unpopulateTimeRFC3339(val, &s.EarliestRestoreDate) - delete(rawMsg, key) - case "fullyQualifiedDomainName": - err = unpopulate(val, &s.FullyQualifiedDomainName) - delete(rawMsg, key) - case "masterServerId": - err = unpopulate(val, &s.MasterServerID) - delete(rawMsg, key) - case "minimalTlsVersion": - err = unpopulate(val, &s.MinimalTLSVersion) - delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, &s.PrivateEndpointConnections) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, &s.PublicNetworkAccess) - delete(rawMsg, key) - case "replicaCapacity": - err = unpopulate(val, &s.ReplicaCapacity) - delete(rawMsg, key) - case "replicationRole": - err = unpopulate(val, &s.ReplicationRole) - delete(rawMsg, key) - case "sslEnforcement": - err = unpopulate(val, &s.SSLEnforcement) - delete(rawMsg, key) - case "storageProfile": - err = unpopulate(val, &s.StorageProfile) - delete(rawMsg, key) - case "userVisibleState": - err = unpopulate(val, &s.UserVisibleState) - delete(rawMsg, key) - case "version": - err = unpopulate(val, &s.Version) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ServerPropertiesForCreateClassification provides polymorphic access to related types. // Call the interface's GetServerPropertiesForCreate() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -1494,11 +1031,6 @@ type ServerPropertiesForCreate struct { Version *ServerVersion `json:"version,omitempty"` } -// GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForCreate. -func (s *ServerPropertiesForCreate) GetServerPropertiesForCreate() *ServerPropertiesForCreate { - return s -} - // ServerPropertiesForDefaultCreate - The properties used to create a new server. type ServerPropertiesForDefaultCreate struct { // REQUIRED; The administrator's login name of a server. Can only be specified when the server is being created (and is required @@ -1528,73 +1060,6 @@ type ServerPropertiesForDefaultCreate struct { Version *ServerVersion `json:"version,omitempty"` } -// GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForDefaultCreate. -func (s *ServerPropertiesForDefaultCreate) GetServerPropertiesForCreate() *ServerPropertiesForCreate { - return &ServerPropertiesForCreate{ - Version: s.Version, - SSLEnforcement: s.SSLEnforcement, - MinimalTLSVersion: s.MinimalTLSVersion, - PublicNetworkAccess: s.PublicNetworkAccess, - StorageProfile: s.StorageProfile, - CreateMode: s.CreateMode, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ServerPropertiesForDefaultCreate. -func (s ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "administratorLogin", s.AdministratorLogin) - populate(objectMap, "administratorLoginPassword", s.AdministratorLoginPassword) - objectMap["createMode"] = CreateModeDefault - populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) - populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) - populate(objectMap, "sslEnforcement", s.SSLEnforcement) - populate(objectMap, "storageProfile", s.StorageProfile) - populate(objectMap, "version", s.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerPropertiesForDefaultCreate. -func (s *ServerPropertiesForDefaultCreate) 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 "administratorLogin": - err = unpopulate(val, &s.AdministratorLogin) - delete(rawMsg, key) - case "administratorLoginPassword": - err = unpopulate(val, &s.AdministratorLoginPassword) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, &s.CreateMode) - delete(rawMsg, key) - case "minimalTlsVersion": - err = unpopulate(val, &s.MinimalTLSVersion) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, &s.PublicNetworkAccess) - delete(rawMsg, key) - case "sslEnforcement": - err = unpopulate(val, &s.SSLEnforcement) - delete(rawMsg, key) - case "storageProfile": - err = unpopulate(val, &s.StorageProfile) - delete(rawMsg, key) - case "version": - err = unpopulate(val, &s.Version) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ServerPropertiesForGeoRestore - The properties used to create a new server by restoring to a different region from a geo // replicated backup. type ServerPropertiesForGeoRestore struct { @@ -1621,69 +1086,6 @@ type ServerPropertiesForGeoRestore struct { Version *ServerVersion `json:"version,omitempty"` } -// GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForGeoRestore. -func (s *ServerPropertiesForGeoRestore) GetServerPropertiesForCreate() *ServerPropertiesForCreate { - return &ServerPropertiesForCreate{ - Version: s.Version, - SSLEnforcement: s.SSLEnforcement, - MinimalTLSVersion: s.MinimalTLSVersion, - PublicNetworkAccess: s.PublicNetworkAccess, - StorageProfile: s.StorageProfile, - CreateMode: s.CreateMode, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ServerPropertiesForGeoRestore. -func (s ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["createMode"] = CreateModeGeoRestore - populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) - populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) - populate(objectMap, "sslEnforcement", s.SSLEnforcement) - populate(objectMap, "sourceServerId", s.SourceServerID) - populate(objectMap, "storageProfile", s.StorageProfile) - populate(objectMap, "version", s.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerPropertiesForGeoRestore. -func (s *ServerPropertiesForGeoRestore) 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 "createMode": - err = unpopulate(val, &s.CreateMode) - delete(rawMsg, key) - case "minimalTlsVersion": - err = unpopulate(val, &s.MinimalTLSVersion) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, &s.PublicNetworkAccess) - delete(rawMsg, key) - case "sslEnforcement": - err = unpopulate(val, &s.SSLEnforcement) - delete(rawMsg, key) - case "sourceServerId": - err = unpopulate(val, &s.SourceServerID) - delete(rawMsg, key) - case "storageProfile": - err = unpopulate(val, &s.StorageProfile) - delete(rawMsg, key) - case "version": - err = unpopulate(val, &s.Version) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ServerPropertiesForReplica - The properties to create a new replica. type ServerPropertiesForReplica struct { // REQUIRED; The mode to create a new server. @@ -1709,69 +1111,6 @@ type ServerPropertiesForReplica struct { Version *ServerVersion `json:"version,omitempty"` } -// GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForReplica. -func (s *ServerPropertiesForReplica) GetServerPropertiesForCreate() *ServerPropertiesForCreate { - return &ServerPropertiesForCreate{ - Version: s.Version, - SSLEnforcement: s.SSLEnforcement, - MinimalTLSVersion: s.MinimalTLSVersion, - PublicNetworkAccess: s.PublicNetworkAccess, - StorageProfile: s.StorageProfile, - CreateMode: s.CreateMode, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ServerPropertiesForReplica. -func (s ServerPropertiesForReplica) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["createMode"] = CreateModeReplica - populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) - populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) - populate(objectMap, "sslEnforcement", s.SSLEnforcement) - populate(objectMap, "sourceServerId", s.SourceServerID) - populate(objectMap, "storageProfile", s.StorageProfile) - populate(objectMap, "version", s.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerPropertiesForReplica. -func (s *ServerPropertiesForReplica) 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 "createMode": - err = unpopulate(val, &s.CreateMode) - delete(rawMsg, key) - case "minimalTlsVersion": - err = unpopulate(val, &s.MinimalTLSVersion) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, &s.PublicNetworkAccess) - delete(rawMsg, key) - case "sslEnforcement": - err = unpopulate(val, &s.SSLEnforcement) - delete(rawMsg, key) - case "sourceServerId": - err = unpopulate(val, &s.SourceServerID) - delete(rawMsg, key) - case "storageProfile": - err = unpopulate(val, &s.StorageProfile) - delete(rawMsg, key) - case "version": - err = unpopulate(val, &s.Version) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ServerPropertiesForRestore - The properties used to create a new server by restoring from a backup. type ServerPropertiesForRestore struct { // REQUIRED; The mode to create a new server. @@ -1800,77 +1139,11 @@ type ServerPropertiesForRestore struct { Version *ServerVersion `json:"version,omitempty"` } -// GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForRestore. -func (s *ServerPropertiesForRestore) GetServerPropertiesForCreate() *ServerPropertiesForCreate { - return &ServerPropertiesForCreate{ - Version: s.Version, - SSLEnforcement: s.SSLEnforcement, - MinimalTLSVersion: s.MinimalTLSVersion, - PublicNetworkAccess: s.PublicNetworkAccess, - StorageProfile: s.StorageProfile, - CreateMode: s.CreateMode, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ServerPropertiesForRestore. -func (s ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["createMode"] = CreateModePointInTimeRestore - populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) - populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) - populateTimeRFC3339(objectMap, "restorePointInTime", s.RestorePointInTime) - populate(objectMap, "sslEnforcement", s.SSLEnforcement) - populate(objectMap, "sourceServerId", s.SourceServerID) - populate(objectMap, "storageProfile", s.StorageProfile) - populate(objectMap, "version", s.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerPropertiesForRestore. -func (s *ServerPropertiesForRestore) 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 "createMode": - err = unpopulate(val, &s.CreateMode) - delete(rawMsg, key) - case "minimalTlsVersion": - err = unpopulate(val, &s.MinimalTLSVersion) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, &s.PublicNetworkAccess) - delete(rawMsg, key) - case "restorePointInTime": - err = unpopulateTimeRFC3339(val, &s.RestorePointInTime) - delete(rawMsg, key) - case "sslEnforcement": - err = unpopulate(val, &s.SSLEnforcement) - delete(rawMsg, key) - case "sourceServerId": - err = unpopulate(val, &s.SourceServerID) - delete(rawMsg, key) - case "storageProfile": - err = unpopulate(val, &s.StorageProfile) - delete(rawMsg, key) - case "version": - err = unpopulate(val, &s.Version) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.BeginCreateOrUpdate // method. type ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ServerSecurityAlertPoliciesClientGetOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.Get @@ -1909,14 +1182,6 @@ type ServerSecurityAlertPolicyListResult struct { Value []*ServerSecurityAlertPolicy `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ServerSecurityAlertPolicyListResult. -func (s ServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - // ServerUpdateParameters - Parameters allowed to update for a server. type ServerUpdateParameters struct { // The properties that can be updated for a server. @@ -1929,15 +1194,6 @@ type ServerUpdateParameters struct { Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ServerUpdateParameters. -func (s ServerUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "sku", s.SKU) - populate(objectMap, "tags", s.Tags) - return json.Marshal(objectMap) -} - // ServerUpdateParametersProperties - The properties that can be updated for a server. type ServerUpdateParametersProperties struct { // The password of the administrator login. @@ -1965,32 +1221,38 @@ type ServerUpdateParametersProperties struct { // ServersClientBeginCreateOptions contains the optional parameters for the ServersClient.BeginCreate method. type ServersClientBeginCreateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ServersClientBeginDeleteOptions contains the optional parameters for the ServersClient.BeginDelete method. type ServersClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ServersClientBeginRestartOptions contains the optional parameters for the ServersClient.BeginRestart method. type ServersClientBeginRestartOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ServersClientBeginStartOptions contains the optional parameters for the ServersClient.BeginStart method. type ServersClientBeginStartOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ServersClientBeginStopOptions contains the optional parameters for the ServersClient.BeginStop method. type ServersClientBeginStopOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ServersClientBeginUpdateOptions contains the optional parameters for the ServersClient.BeginUpdate method. type ServersClientBeginUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ServersClientGetOptions contains the optional parameters for the ServersClient.Get method. @@ -2029,13 +1291,6 @@ type TagsObject struct { Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type TagsObject. -func (t TagsObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", t.Tags) - return json.Marshal(objectMap) -} - // TopQueryStatisticsClientGetOptions contains the optional parameters for the TopQueryStatisticsClient.Get method. type TopQueryStatisticsClientGetOptions struct { // placeholder for future optional parameters @@ -2074,53 +1329,6 @@ type TopQueryStatisticsInputProperties struct { ObservedMetric *string `json:"observedMetric,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type TopQueryStatisticsInputProperties. -func (t TopQueryStatisticsInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregationFunction", t.AggregationFunction) - populate(objectMap, "aggregationWindow", t.AggregationWindow) - populate(objectMap, "numberOfTopQueries", t.NumberOfTopQueries) - populateTimeRFC3339(objectMap, "observationEndTime", t.ObservationEndTime) - populateTimeRFC3339(objectMap, "observationStartTime", t.ObservationStartTime) - populate(objectMap, "observedMetric", t.ObservedMetric) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TopQueryStatisticsInputProperties. -func (t *TopQueryStatisticsInputProperties) 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 "aggregationFunction": - err = unpopulate(val, &t.AggregationFunction) - delete(rawMsg, key) - case "aggregationWindow": - err = unpopulate(val, &t.AggregationWindow) - delete(rawMsg, key) - case "numberOfTopQueries": - err = unpopulate(val, &t.NumberOfTopQueries) - delete(rawMsg, key) - case "observationEndTime": - err = unpopulateTimeRFC3339(val, &t.ObservationEndTime) - delete(rawMsg, key) - case "observationStartTime": - err = unpopulateTimeRFC3339(val, &t.ObservationStartTime) - delete(rawMsg, key) - case "observedMetric": - err = unpopulate(val, &t.ObservedMetric) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // TopQueryStatisticsResultList - A list of query statistics. type TopQueryStatisticsResultList struct { // READ-ONLY; Link to retrieve next page of results. @@ -2130,14 +1338,6 @@ type TopQueryStatisticsResultList struct { Value []*QueryStatistic `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type TopQueryStatisticsResultList. -func (t TopQueryStatisticsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", t.NextLink) - populate(objectMap, "value", t.Value) - return json.Marshal(objectMap) -} - // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { @@ -2157,17 +1357,6 @@ type TrackedResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - // VirtualNetworkRule - A virtual network rule. type VirtualNetworkRule struct { // Resource properties. @@ -2192,14 +1381,6 @@ type VirtualNetworkRuleListResult struct { Value []*VirtualNetworkRule `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkRuleListResult. -func (v VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", v.NextLink) - populate(objectMap, "value", v.Value) - return json.Marshal(objectMap) -} - // VirtualNetworkRuleProperties - Properties of a virtual network rule. type VirtualNetworkRuleProperties struct { // REQUIRED; The ARM resource id of the virtual network subnet. @@ -2215,13 +1396,15 @@ type VirtualNetworkRuleProperties struct { // VirtualNetworkRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkRulesClient.BeginCreateOrUpdate // method. type VirtualNetworkRulesClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // VirtualNetworkRulesClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkRulesClient.BeginDelete // method. type VirtualNetworkRulesClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // VirtualNetworkRulesClientGetOptions contains the optional parameters for the VirtualNetworkRulesClient.Get method. @@ -2280,65 +1463,6 @@ type WaitStatisticProperties struct { UserID *int64 `json:"userId,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type WaitStatisticProperties. -func (w WaitStatisticProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "count", w.Count) - populate(objectMap, "databaseName", w.DatabaseName) - populateTimeRFC3339(objectMap, "endTime", w.EndTime) - populate(objectMap, "eventName", w.EventName) - populate(objectMap, "eventTypeName", w.EventTypeName) - populate(objectMap, "queryId", w.QueryID) - populateTimeRFC3339(objectMap, "startTime", w.StartTime) - populate(objectMap, "totalTimeInMs", w.TotalTimeInMs) - populate(objectMap, "userId", w.UserID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WaitStatisticProperties. -func (w *WaitStatisticProperties) 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 "count": - err = unpopulate(val, &w.Count) - delete(rawMsg, key) - case "databaseName": - err = unpopulate(val, &w.DatabaseName) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, &w.EndTime) - delete(rawMsg, key) - case "eventName": - err = unpopulate(val, &w.EventName) - delete(rawMsg, key) - case "eventTypeName": - err = unpopulate(val, &w.EventTypeName) - delete(rawMsg, key) - case "queryId": - err = unpopulate(val, &w.QueryID) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &w.StartTime) - delete(rawMsg, key) - case "totalTimeInMs": - err = unpopulate(val, &w.TotalTimeInMs) - delete(rawMsg, key) - case "userId": - err = unpopulate(val, &w.UserID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // WaitStatisticsClientGetOptions contains the optional parameters for the WaitStatisticsClient.Get method. type WaitStatisticsClientGetOptions struct { // placeholder for future optional parameters @@ -2367,41 +1491,6 @@ type WaitStatisticsInputProperties struct { ObservationStartTime *time.Time `json:"observationStartTime,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type WaitStatisticsInputProperties. -func (w WaitStatisticsInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregationWindow", w.AggregationWindow) - populateTimeRFC3339(objectMap, "observationEndTime", w.ObservationEndTime) - populateTimeRFC3339(objectMap, "observationStartTime", w.ObservationStartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WaitStatisticsInputProperties. -func (w *WaitStatisticsInputProperties) 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 "aggregationWindow": - err = unpopulate(val, &w.AggregationWindow) - delete(rawMsg, key) - case "observationEndTime": - err = unpopulateTimeRFC3339(val, &w.ObservationEndTime) - delete(rawMsg, key) - case "observationStartTime": - err = unpopulateTimeRFC3339(val, &w.ObservationStartTime) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // WaitStatisticsResultList - A list of wait statistics. type WaitStatisticsResultList struct { // READ-ONLY; Link to retrieve next page of results. @@ -2410,28 +1499,3 @@ type WaitStatisticsResultList struct { // READ-ONLY; The list of wait statistics. Value []*WaitStatistic `json:"value,omitempty" azure:"ro"` } - -// MarshalJSON implements the json.Marshaller interface for type WaitStatisticsResultList. -func (w WaitStatisticsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", w.NextLink) - populate(objectMap, "value", w.Value) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_models_serde.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_models_serde.go new file mode 100644 index 000000000000..99172c515f01 --- /dev/null +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_models_serde.go @@ -0,0 +1,965 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmariadb + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AdvisorsResultList. +func (a AdvisorsResultList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationListResult. +func (c ConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseListResult. +func (d DatabaseListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) 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) +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallRuleListResult. +func (f FirewallRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type LogFileListResult. +func (l LogFileListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type LogFileProperties. +func (l LogFileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileProperties. +func (l *LogFileProperties) 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 "createdTime": + err = unpopulateTimeRFC3339(val, &l.CreatedTime) + delete(rawMsg, key) + case "lastModifiedTime": + err = unpopulateTimeRFC3339(val, &l.LastModifiedTime) + delete(rawMsg, key) + case "sizeInKB": + err = unpopulate(val, &l.SizeInKB) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &l.Type) + delete(rawMsg, key) + case "url": + err = unpopulate(val, &l.URL) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PerformanceTierListResult. +func (p PerformanceTierListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PerformanceTierProperties. +func (p PerformanceTierProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "maxBackupRetentionDays", p.MaxBackupRetentionDays) + populate(objectMap, "maxLargeStorageMB", p.MaxLargeStorageMB) + populate(objectMap, "maxStorageMB", p.MaxStorageMB) + populate(objectMap, "minBackupRetentionDays", p.MinBackupRetentionDays) + populate(objectMap, "minLargeStorageMB", p.MinLargeStorageMB) + populate(objectMap, "minStorageMB", p.MinStorageMB) + populate(objectMap, "serviceLevelObjectives", p.ServiceLevelObjectives) + return json.Marshal(objectMap) +} + +// 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) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type QueryStatisticProperties. +func (q QueryStatisticProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationFunction", q.AggregationFunction) + populate(objectMap, "databaseNames", q.DatabaseNames) + 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) + populateTimeRFC3339(objectMap, "startTime", q.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryStatisticProperties. +func (q *QueryStatisticProperties) 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 "aggregationFunction": + err = unpopulate(val, &q.AggregationFunction) + delete(rawMsg, key) + case "databaseNames": + err = unpopulate(val, &q.DatabaseNames) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, &q.EndTime) + delete(rawMsg, key) + case "metricDisplayName": + err = unpopulate(val, &q.MetricDisplayName) + delete(rawMsg, key) + case "metricName": + err = unpopulate(val, &q.MetricName) + delete(rawMsg, key) + case "metricValue": + err = unpopulate(val, &q.MetricValue) + delete(rawMsg, key) + case "metricValueUnit": + err = unpopulate(val, &q.MetricValueUnit) + delete(rawMsg, key) + case "queryExecutionCount": + err = unpopulate(val, &q.QueryExecutionCount) + delete(rawMsg, key) + case "queryId": + err = unpopulate(val, &q.QueryID) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &q.StartTime) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryTextsResultList. +func (q QueryTextsResultList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", q.NextLink) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RecommendationActionProperties. +func (r RecommendationActionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionId", r.ActionID) + populate(objectMap, "advisorName", r.AdvisorName) + populateTimeRFC3339(objectMap, "createdTime", r.CreatedTime) + populate(objectMap, "details", r.Details) + populateTimeRFC3339(objectMap, "expirationTime", r.ExpirationTime) + populate(objectMap, "reason", r.Reason) + populate(objectMap, "recommendationType", r.RecommendationType) + populate(objectMap, "sessionId", r.SessionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendationActionProperties. +func (r *RecommendationActionProperties) 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 "actionId": + err = unpopulate(val, &r.ActionID) + delete(rawMsg, key) + case "advisorName": + err = unpopulate(val, &r.AdvisorName) + delete(rawMsg, key) + case "createdTime": + err = unpopulateTimeRFC3339(val, &r.CreatedTime) + delete(rawMsg, key) + case "details": + err = unpopulate(val, &r.Details) + delete(rawMsg, key) + case "expirationTime": + err = unpopulateTimeRFC3339(val, &r.ExpirationTime) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, &r.Reason) + delete(rawMsg, key) + case "recommendationType": + err = unpopulate(val, &r.RecommendationType) + delete(rawMsg, key) + case "sessionId": + err = unpopulate(val, &r.SessionID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecommendationActionsResultList. +func (r RecommendationActionsResultList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RecommendedActionSessionsOperationStatus. +func (r RecommendedActionSessionsOperationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", r.Name) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionSessionsOperationStatus. +func (r *RecommendedActionSessionsOperationStatus) 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 "name": + err = unpopulate(val, &r.Name) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &r.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, &r.Status) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityAlertPolicyProperties. +func (s SecurityAlertPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "disabledAlerts", s.DisabledAlerts) + populate(objectMap, "emailAccountAdmins", s.EmailAccountAdmins) + populate(objectMap, "emailAddresses", s.EmailAddresses) + populate(objectMap, "retentionDays", s.RetentionDays) + populate(objectMap, "state", s.State) + populate(objectMap, "storageAccountAccessKey", s.StorageAccountAccessKey) + populate(objectMap, "storageEndpoint", s.StorageEndpoint) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Server. +func (s Server) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ServerForCreate. +func (s ServerForCreate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", s.Location) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerForCreate. +func (s *ServerForCreate) 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 "location": + err = unpopulate(val, &s.Location) + delete(rawMsg, key) + case "properties": + s.Properties, err = unmarshalServerPropertiesForCreateClassification(val) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, &s.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, &s.Tags) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerListResult. +func (s ServerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ServerProperties. +func (s ServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "administratorLogin", s.AdministratorLogin) + populateTimeRFC3339(objectMap, "earliestRestoreDate", s.EarliestRestoreDate) + populate(objectMap, "fullyQualifiedDomainName", s.FullyQualifiedDomainName) + populate(objectMap, "masterServerId", s.MasterServerID) + populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) + populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) + populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) + populate(objectMap, "replicaCapacity", s.ReplicaCapacity) + populate(objectMap, "replicationRole", s.ReplicationRole) + populate(objectMap, "sslEnforcement", s.SSLEnforcement) + populate(objectMap, "storageProfile", s.StorageProfile) + populate(objectMap, "userVisibleState", s.UserVisibleState) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerProperties. +func (s *ServerProperties) 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 "administratorLogin": + err = unpopulate(val, &s.AdministratorLogin) + delete(rawMsg, key) + case "earliestRestoreDate": + err = unpopulateTimeRFC3339(val, &s.EarliestRestoreDate) + delete(rawMsg, key) + case "fullyQualifiedDomainName": + err = unpopulate(val, &s.FullyQualifiedDomainName) + delete(rawMsg, key) + case "masterServerId": + err = unpopulate(val, &s.MasterServerID) + delete(rawMsg, key) + case "minimalTlsVersion": + err = unpopulate(val, &s.MinimalTLSVersion) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, &s.PrivateEndpointConnections) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, &s.PublicNetworkAccess) + delete(rawMsg, key) + case "replicaCapacity": + err = unpopulate(val, &s.ReplicaCapacity) + delete(rawMsg, key) + case "replicationRole": + err = unpopulate(val, &s.ReplicationRole) + delete(rawMsg, key) + case "sslEnforcement": + err = unpopulate(val, &s.SSLEnforcement) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, &s.StorageProfile) + delete(rawMsg, key) + case "userVisibleState": + err = unpopulate(val, &s.UserVisibleState) + delete(rawMsg, key) + case "version": + err = unpopulate(val, &s.Version) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForCreate. +func (s *ServerPropertiesForCreate) GetServerPropertiesForCreate() *ServerPropertiesForCreate { + return s +} + +// GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForDefaultCreate. +func (s *ServerPropertiesForDefaultCreate) GetServerPropertiesForCreate() *ServerPropertiesForCreate { + return &ServerPropertiesForCreate{ + Version: s.Version, + SSLEnforcement: s.SSLEnforcement, + MinimalTLSVersion: s.MinimalTLSVersion, + PublicNetworkAccess: s.PublicNetworkAccess, + StorageProfile: s.StorageProfile, + CreateMode: s.CreateMode, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ServerPropertiesForDefaultCreate. +func (s ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "administratorLogin", s.AdministratorLogin) + populate(objectMap, "administratorLoginPassword", s.AdministratorLoginPassword) + objectMap["createMode"] = CreateModeDefault + populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) + populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) + populate(objectMap, "sslEnforcement", s.SSLEnforcement) + populate(objectMap, "storageProfile", s.StorageProfile) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerPropertiesForDefaultCreate. +func (s *ServerPropertiesForDefaultCreate) 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 "administratorLogin": + err = unpopulate(val, &s.AdministratorLogin) + delete(rawMsg, key) + case "administratorLoginPassword": + err = unpopulate(val, &s.AdministratorLoginPassword) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, &s.CreateMode) + delete(rawMsg, key) + case "minimalTlsVersion": + err = unpopulate(val, &s.MinimalTLSVersion) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, &s.PublicNetworkAccess) + delete(rawMsg, key) + case "sslEnforcement": + err = unpopulate(val, &s.SSLEnforcement) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, &s.StorageProfile) + delete(rawMsg, key) + case "version": + err = unpopulate(val, &s.Version) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForGeoRestore. +func (s *ServerPropertiesForGeoRestore) GetServerPropertiesForCreate() *ServerPropertiesForCreate { + return &ServerPropertiesForCreate{ + Version: s.Version, + SSLEnforcement: s.SSLEnforcement, + MinimalTLSVersion: s.MinimalTLSVersion, + PublicNetworkAccess: s.PublicNetworkAccess, + StorageProfile: s.StorageProfile, + CreateMode: s.CreateMode, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ServerPropertiesForGeoRestore. +func (s ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["createMode"] = CreateModeGeoRestore + populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) + populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) + populate(objectMap, "sslEnforcement", s.SSLEnforcement) + populate(objectMap, "sourceServerId", s.SourceServerID) + populate(objectMap, "storageProfile", s.StorageProfile) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerPropertiesForGeoRestore. +func (s *ServerPropertiesForGeoRestore) 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 "createMode": + err = unpopulate(val, &s.CreateMode) + delete(rawMsg, key) + case "minimalTlsVersion": + err = unpopulate(val, &s.MinimalTLSVersion) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, &s.PublicNetworkAccess) + delete(rawMsg, key) + case "sslEnforcement": + err = unpopulate(val, &s.SSLEnforcement) + delete(rawMsg, key) + case "sourceServerId": + err = unpopulate(val, &s.SourceServerID) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, &s.StorageProfile) + delete(rawMsg, key) + case "version": + err = unpopulate(val, &s.Version) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForReplica. +func (s *ServerPropertiesForReplica) GetServerPropertiesForCreate() *ServerPropertiesForCreate { + return &ServerPropertiesForCreate{ + Version: s.Version, + SSLEnforcement: s.SSLEnforcement, + MinimalTLSVersion: s.MinimalTLSVersion, + PublicNetworkAccess: s.PublicNetworkAccess, + StorageProfile: s.StorageProfile, + CreateMode: s.CreateMode, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ServerPropertiesForReplica. +func (s ServerPropertiesForReplica) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["createMode"] = CreateModeReplica + populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) + populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) + populate(objectMap, "sslEnforcement", s.SSLEnforcement) + populate(objectMap, "sourceServerId", s.SourceServerID) + populate(objectMap, "storageProfile", s.StorageProfile) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerPropertiesForReplica. +func (s *ServerPropertiesForReplica) 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 "createMode": + err = unpopulate(val, &s.CreateMode) + delete(rawMsg, key) + case "minimalTlsVersion": + err = unpopulate(val, &s.MinimalTLSVersion) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, &s.PublicNetworkAccess) + delete(rawMsg, key) + case "sslEnforcement": + err = unpopulate(val, &s.SSLEnforcement) + delete(rawMsg, key) + case "sourceServerId": + err = unpopulate(val, &s.SourceServerID) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, &s.StorageProfile) + delete(rawMsg, key) + case "version": + err = unpopulate(val, &s.Version) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForRestore. +func (s *ServerPropertiesForRestore) GetServerPropertiesForCreate() *ServerPropertiesForCreate { + return &ServerPropertiesForCreate{ + Version: s.Version, + SSLEnforcement: s.SSLEnforcement, + MinimalTLSVersion: s.MinimalTLSVersion, + PublicNetworkAccess: s.PublicNetworkAccess, + StorageProfile: s.StorageProfile, + CreateMode: s.CreateMode, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ServerPropertiesForRestore. +func (s ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["createMode"] = CreateModePointInTimeRestore + populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) + populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) + populateTimeRFC3339(objectMap, "restorePointInTime", s.RestorePointInTime) + populate(objectMap, "sslEnforcement", s.SSLEnforcement) + populate(objectMap, "sourceServerId", s.SourceServerID) + populate(objectMap, "storageProfile", s.StorageProfile) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerPropertiesForRestore. +func (s *ServerPropertiesForRestore) 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 "createMode": + err = unpopulate(val, &s.CreateMode) + delete(rawMsg, key) + case "minimalTlsVersion": + err = unpopulate(val, &s.MinimalTLSVersion) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, &s.PublicNetworkAccess) + delete(rawMsg, key) + case "restorePointInTime": + err = unpopulateTimeRFC3339(val, &s.RestorePointInTime) + delete(rawMsg, key) + case "sslEnforcement": + err = unpopulate(val, &s.SSLEnforcement) + delete(rawMsg, key) + case "sourceServerId": + err = unpopulate(val, &s.SourceServerID) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, &s.StorageProfile) + delete(rawMsg, key) + case "version": + err = unpopulate(val, &s.Version) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerSecurityAlertPolicyListResult. +func (s ServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ServerUpdateParameters. +func (s ServerUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type TagsObject. +func (t TagsObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type TopQueryStatisticsInputProperties. +func (t TopQueryStatisticsInputProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationFunction", t.AggregationFunction) + populate(objectMap, "aggregationWindow", t.AggregationWindow) + populate(objectMap, "numberOfTopQueries", t.NumberOfTopQueries) + populateTimeRFC3339(objectMap, "observationEndTime", t.ObservationEndTime) + populateTimeRFC3339(objectMap, "observationStartTime", t.ObservationStartTime) + populate(objectMap, "observedMetric", t.ObservedMetric) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TopQueryStatisticsInputProperties. +func (t *TopQueryStatisticsInputProperties) 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 "aggregationFunction": + err = unpopulate(val, &t.AggregationFunction) + delete(rawMsg, key) + case "aggregationWindow": + err = unpopulate(val, &t.AggregationWindow) + delete(rawMsg, key) + case "numberOfTopQueries": + err = unpopulate(val, &t.NumberOfTopQueries) + delete(rawMsg, key) + case "observationEndTime": + err = unpopulateTimeRFC3339(val, &t.ObservationEndTime) + delete(rawMsg, key) + case "observationStartTime": + err = unpopulateTimeRFC3339(val, &t.ObservationStartTime) + delete(rawMsg, key) + case "observedMetric": + err = unpopulate(val, &t.ObservedMetric) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TopQueryStatisticsResultList. +func (t TopQueryStatisticsResultList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkRuleListResult. +func (v VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type WaitStatisticProperties. +func (w WaitStatisticProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "count", w.Count) + populate(objectMap, "databaseName", w.DatabaseName) + populateTimeRFC3339(objectMap, "endTime", w.EndTime) + populate(objectMap, "eventName", w.EventName) + populate(objectMap, "eventTypeName", w.EventTypeName) + populate(objectMap, "queryId", w.QueryID) + populateTimeRFC3339(objectMap, "startTime", w.StartTime) + populate(objectMap, "totalTimeInMs", w.TotalTimeInMs) + populate(objectMap, "userId", w.UserID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WaitStatisticProperties. +func (w *WaitStatisticProperties) 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 "count": + err = unpopulate(val, &w.Count) + delete(rawMsg, key) + case "databaseName": + err = unpopulate(val, &w.DatabaseName) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, &w.EndTime) + delete(rawMsg, key) + case "eventName": + err = unpopulate(val, &w.EventName) + delete(rawMsg, key) + case "eventTypeName": + err = unpopulate(val, &w.EventTypeName) + delete(rawMsg, key) + case "queryId": + err = unpopulate(val, &w.QueryID) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &w.StartTime) + delete(rawMsg, key) + case "totalTimeInMs": + err = unpopulate(val, &w.TotalTimeInMs) + delete(rawMsg, key) + case "userId": + err = unpopulate(val, &w.UserID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WaitStatisticsInputProperties. +func (w WaitStatisticsInputProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationWindow", w.AggregationWindow) + populateTimeRFC3339(objectMap, "observationEndTime", w.ObservationEndTime) + populateTimeRFC3339(objectMap, "observationStartTime", w.ObservationStartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WaitStatisticsInputProperties. +func (w *WaitStatisticsInputProperties) 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 "aggregationWindow": + err = unpopulate(val, &w.AggregationWindow) + delete(rawMsg, key) + case "observationEndTime": + err = unpopulateTimeRFC3339(val, &w.ObservationEndTime) + delete(rawMsg, key) + case "observationStartTime": + err = unpopulateTimeRFC3339(val, &w.ObservationStartTime) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WaitStatisticsResultList. +func (w WaitStatisticsResultList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_operations_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_operations_client.go index fe23cd891300..77f510b8b11e 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_operations_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,19 +29,23 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Lists all of the available REST API operations. @@ -77,7 +82,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_pagers.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_pagers.go deleted file mode 100644 index dec02d03500d..000000000000 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_pagers.go +++ /dev/null @@ -1,557 +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 armmariadb - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// AdvisorsClientListByServerPager provides operations for iterating over paged responses. -type AdvisorsClientListByServerPager struct { - client *AdvisorsClient - current AdvisorsClientListByServerResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, AdvisorsClientListByServerResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *AdvisorsClientListByServerPager) 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 *AdvisorsClientListByServerPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.AdvisorsResultList.NextLink == nil || len(*p.current.AdvisorsResultList.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByServerHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current AdvisorsClientListByServerResponse page. -func (p *AdvisorsClientListByServerPager) PageResponse() AdvisorsClientListByServerResponse { - return p.current -} - -// LocationBasedRecommendedActionSessionsResultClientListPager provides operations for iterating over paged responses. -type LocationBasedRecommendedActionSessionsResultClientListPager struct { - client *LocationBasedRecommendedActionSessionsResultClient - current LocationBasedRecommendedActionSessionsResultClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, LocationBasedRecommendedActionSessionsResultClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *LocationBasedRecommendedActionSessionsResultClientListPager) 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 *LocationBasedRecommendedActionSessionsResultClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.RecommendationActionsResultList.NextLink == nil || len(*p.current.RecommendationActionsResultList.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, http.StatusCreated) { - p.err = runtime.NewResponseError(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 LocationBasedRecommendedActionSessionsResultClientListResponse page. -func (p *LocationBasedRecommendedActionSessionsResultClientListPager) PageResponse() LocationBasedRecommendedActionSessionsResultClientListResponse { - return p.current -} - -// PrivateEndpointConnectionsClientListByServerPager provides operations for iterating over paged responses. -type PrivateEndpointConnectionsClientListByServerPager struct { - client *PrivateEndpointConnectionsClient - current PrivateEndpointConnectionsClientListByServerResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PrivateEndpointConnectionsClientListByServerResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PrivateEndpointConnectionsClientListByServerPager) 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 *PrivateEndpointConnectionsClientListByServerPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PrivateEndpointConnectionListResult.NextLink == nil || len(*p.current.PrivateEndpointConnectionListResult.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByServerHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PrivateEndpointConnectionsClientListByServerResponse page. -func (p *PrivateEndpointConnectionsClientListByServerPager) PageResponse() PrivateEndpointConnectionsClientListByServerResponse { - return p.current -} - -// PrivateLinkResourcesClientListByServerPager provides operations for iterating over paged responses. -type PrivateLinkResourcesClientListByServerPager struct { - client *PrivateLinkResourcesClient - current PrivateLinkResourcesClientListByServerResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PrivateLinkResourcesClientListByServerResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PrivateLinkResourcesClientListByServerPager) 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 *PrivateLinkResourcesClientListByServerPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PrivateLinkResourceListResult.NextLink == nil || len(*p.current.PrivateLinkResourceListResult.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByServerHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PrivateLinkResourcesClientListByServerResponse page. -func (p *PrivateLinkResourcesClientListByServerPager) PageResponse() PrivateLinkResourcesClientListByServerResponse { - return p.current -} - -// QueryTextsClientListByServerPager provides operations for iterating over paged responses. -type QueryTextsClientListByServerPager struct { - client *QueryTextsClient - current QueryTextsClientListByServerResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, QueryTextsClientListByServerResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *QueryTextsClientListByServerPager) 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 *QueryTextsClientListByServerPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.QueryTextsResultList.NextLink == nil || len(*p.current.QueryTextsResultList.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByServerHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current QueryTextsClientListByServerResponse page. -func (p *QueryTextsClientListByServerPager) PageResponse() QueryTextsClientListByServerResponse { - return p.current -} - -// RecommendedActionsClientListByServerPager provides operations for iterating over paged responses. -type RecommendedActionsClientListByServerPager struct { - client *RecommendedActionsClient - current RecommendedActionsClientListByServerResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, RecommendedActionsClientListByServerResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *RecommendedActionsClientListByServerPager) 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 *RecommendedActionsClientListByServerPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.RecommendationActionsResultList.NextLink == nil || len(*p.current.RecommendationActionsResultList.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByServerHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current RecommendedActionsClientListByServerResponse page. -func (p *RecommendedActionsClientListByServerPager) PageResponse() RecommendedActionsClientListByServerResponse { - return p.current -} - -// ServerSecurityAlertPoliciesClientListByServerPager provides operations for iterating over paged responses. -type ServerSecurityAlertPoliciesClientListByServerPager struct { - client *ServerSecurityAlertPoliciesClient - current ServerSecurityAlertPoliciesClientListByServerResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ServerSecurityAlertPoliciesClientListByServerResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ServerSecurityAlertPoliciesClientListByServerPager) 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 *ServerSecurityAlertPoliciesClientListByServerPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ServerSecurityAlertPolicyListResult.NextLink == nil || len(*p.current.ServerSecurityAlertPolicyListResult.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByServerHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ServerSecurityAlertPoliciesClientListByServerResponse page. -func (p *ServerSecurityAlertPoliciesClientListByServerPager) PageResponse() ServerSecurityAlertPoliciesClientListByServerResponse { - return p.current -} - -// TopQueryStatisticsClientListByServerPager provides operations for iterating over paged responses. -type TopQueryStatisticsClientListByServerPager struct { - client *TopQueryStatisticsClient - current TopQueryStatisticsClientListByServerResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, TopQueryStatisticsClientListByServerResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *TopQueryStatisticsClientListByServerPager) 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 *TopQueryStatisticsClientListByServerPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.TopQueryStatisticsResultList.NextLink == nil || len(*p.current.TopQueryStatisticsResultList.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByServerHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current TopQueryStatisticsClientListByServerResponse page. -func (p *TopQueryStatisticsClientListByServerPager) PageResponse() TopQueryStatisticsClientListByServerResponse { - return p.current -} - -// VirtualNetworkRulesClientListByServerPager provides operations for iterating over paged responses. -type VirtualNetworkRulesClientListByServerPager struct { - client *VirtualNetworkRulesClient - current VirtualNetworkRulesClientListByServerResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, VirtualNetworkRulesClientListByServerResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *VirtualNetworkRulesClientListByServerPager) 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 *VirtualNetworkRulesClientListByServerPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.VirtualNetworkRuleListResult.NextLink == nil || len(*p.current.VirtualNetworkRuleListResult.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByServerHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current VirtualNetworkRulesClientListByServerResponse page. -func (p *VirtualNetworkRulesClientListByServerPager) PageResponse() VirtualNetworkRulesClientListByServerResponse { - return p.current -} - -// WaitStatisticsClientListByServerPager provides operations for iterating over paged responses. -type WaitStatisticsClientListByServerPager struct { - client *WaitStatisticsClient - current WaitStatisticsClientListByServerResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, WaitStatisticsClientListByServerResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *WaitStatisticsClientListByServerPager) 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 *WaitStatisticsClientListByServerPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.WaitStatisticsResultList.NextLink == nil || len(*p.current.WaitStatisticsResultList.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 = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByServerHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current WaitStatisticsClientListByServerResponse page. -func (p *WaitStatisticsClientListByServerPager) PageResponse() WaitStatisticsClientListByServerResponse { - return p.current -} diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_pollers.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_pollers.go deleted file mode 100644 index 8b4fb2e5f9a4..000000000000 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_pollers.go +++ /dev/null @@ -1,832 +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 armmariadb - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// ConfigurationsClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type ConfigurationsClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ConfigurationsClientCreateOrUpdatePoller) 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 *ConfigurationsClientCreateOrUpdatePoller) 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 ConfigurationsClientCreateOrUpdateResponse will be returned. -func (p *ConfigurationsClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (ConfigurationsClientCreateOrUpdateResponse, error) { - respType := ConfigurationsClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.Configuration) - if err != nil { - return ConfigurationsClientCreateOrUpdateResponse{}, 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 *ConfigurationsClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// DatabasesClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type DatabasesClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *DatabasesClientCreateOrUpdatePoller) 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 *DatabasesClientCreateOrUpdatePoller) 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 DatabasesClientCreateOrUpdateResponse will be returned. -func (p *DatabasesClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (DatabasesClientCreateOrUpdateResponse, error) { - respType := DatabasesClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.Database) - if err != nil { - return DatabasesClientCreateOrUpdateResponse{}, 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 *DatabasesClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// DatabasesClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type DatabasesClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *DatabasesClientDeletePoller) 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 *DatabasesClientDeletePoller) 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 DatabasesClientDeleteResponse will be returned. -func (p *DatabasesClientDeletePoller) FinalResponse(ctx context.Context) (DatabasesClientDeleteResponse, error) { - respType := DatabasesClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return DatabasesClientDeleteResponse{}, 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 *DatabasesClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// FirewallRulesClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type FirewallRulesClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *FirewallRulesClientCreateOrUpdatePoller) 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 *FirewallRulesClientCreateOrUpdatePoller) 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 FirewallRulesClientCreateOrUpdateResponse will be returned. -func (p *FirewallRulesClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (FirewallRulesClientCreateOrUpdateResponse, error) { - respType := FirewallRulesClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.FirewallRule) - if err != nil { - return FirewallRulesClientCreateOrUpdateResponse{}, 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 *FirewallRulesClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// FirewallRulesClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type FirewallRulesClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *FirewallRulesClientDeletePoller) 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 *FirewallRulesClientDeletePoller) 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 FirewallRulesClientDeleteResponse will be returned. -func (p *FirewallRulesClientDeletePoller) FinalResponse(ctx context.Context) (FirewallRulesClientDeleteResponse, error) { - respType := FirewallRulesClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return FirewallRulesClientDeleteResponse{}, 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 *FirewallRulesClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ManagementClientCreateRecommendedActionSessionPoller provides polling facilities until the operation reaches a terminal state. -type ManagementClientCreateRecommendedActionSessionPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ManagementClientCreateRecommendedActionSessionPoller) 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 *ManagementClientCreateRecommendedActionSessionPoller) 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 ManagementClientCreateRecommendedActionSessionResponse will be returned. -func (p *ManagementClientCreateRecommendedActionSessionPoller) FinalResponse(ctx context.Context) (ManagementClientCreateRecommendedActionSessionResponse, error) { - respType := ManagementClientCreateRecommendedActionSessionResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return ManagementClientCreateRecommendedActionSessionResponse{}, 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 *ManagementClientCreateRecommendedActionSessionPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PrivateEndpointConnectionsClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type PrivateEndpointConnectionsClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PrivateEndpointConnectionsClientCreateOrUpdatePoller) 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 *PrivateEndpointConnectionsClientCreateOrUpdatePoller) 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 PrivateEndpointConnectionsClientCreateOrUpdateResponse will be returned. -func (p *PrivateEndpointConnectionsClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error) { - respType := PrivateEndpointConnectionsClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.PrivateEndpointConnection) - if err != nil { - return PrivateEndpointConnectionsClientCreateOrUpdateResponse{}, 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 *PrivateEndpointConnectionsClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PrivateEndpointConnectionsClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type PrivateEndpointConnectionsClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PrivateEndpointConnectionsClientDeletePoller) 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 *PrivateEndpointConnectionsClientDeletePoller) 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 PrivateEndpointConnectionsClientDeleteResponse will be returned. -func (p *PrivateEndpointConnectionsClientDeletePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsClientDeleteResponse, error) { - respType := PrivateEndpointConnectionsClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return PrivateEndpointConnectionsClientDeleteResponse{}, 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 *PrivateEndpointConnectionsClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PrivateEndpointConnectionsClientUpdateTagsPoller provides polling facilities until the operation reaches a terminal state. -type PrivateEndpointConnectionsClientUpdateTagsPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PrivateEndpointConnectionsClientUpdateTagsPoller) 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 *PrivateEndpointConnectionsClientUpdateTagsPoller) 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 PrivateEndpointConnectionsClientUpdateTagsResponse will be returned. -func (p *PrivateEndpointConnectionsClientUpdateTagsPoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsClientUpdateTagsResponse, error) { - respType := PrivateEndpointConnectionsClientUpdateTagsResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.PrivateEndpointConnection) - if err != nil { - return PrivateEndpointConnectionsClientUpdateTagsResponse{}, 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 *PrivateEndpointConnectionsClientUpdateTagsPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ServerParametersClientListUpdateConfigurationsPoller provides polling facilities until the operation reaches a terminal state. -type ServerParametersClientListUpdateConfigurationsPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ServerParametersClientListUpdateConfigurationsPoller) 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 *ServerParametersClientListUpdateConfigurationsPoller) 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 ServerParametersClientListUpdateConfigurationsResponse will be returned. -func (p *ServerParametersClientListUpdateConfigurationsPoller) FinalResponse(ctx context.Context) (ServerParametersClientListUpdateConfigurationsResponse, error) { - respType := ServerParametersClientListUpdateConfigurationsResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ConfigurationListResult) - if err != nil { - return ServerParametersClientListUpdateConfigurationsResponse{}, 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 *ServerParametersClientListUpdateConfigurationsPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ServerSecurityAlertPoliciesClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type ServerSecurityAlertPoliciesClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ServerSecurityAlertPoliciesClientCreateOrUpdatePoller) 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 *ServerSecurityAlertPoliciesClientCreateOrUpdatePoller) 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 ServerSecurityAlertPoliciesClientCreateOrUpdateResponse will be returned. -func (p *ServerSecurityAlertPoliciesClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (ServerSecurityAlertPoliciesClientCreateOrUpdateResponse, error) { - respType := ServerSecurityAlertPoliciesClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ServerSecurityAlertPolicy) - if err != nil { - return ServerSecurityAlertPoliciesClientCreateOrUpdateResponse{}, 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 *ServerSecurityAlertPoliciesClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ServersClientCreatePoller provides polling facilities until the operation reaches a terminal state. -type ServersClientCreatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ServersClientCreatePoller) 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 *ServersClientCreatePoller) 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 ServersClientCreateResponse will be returned. -func (p *ServersClientCreatePoller) FinalResponse(ctx context.Context) (ServersClientCreateResponse, error) { - respType := ServersClientCreateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.Server) - if err != nil { - return ServersClientCreateResponse{}, 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 *ServersClientCreatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ServersClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type ServersClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ServersClientDeletePoller) 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 *ServersClientDeletePoller) 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 ServersClientDeleteResponse will be returned. -func (p *ServersClientDeletePoller) FinalResponse(ctx context.Context) (ServersClientDeleteResponse, error) { - respType := ServersClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return ServersClientDeleteResponse{}, 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 *ServersClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ServersClientRestartPoller provides polling facilities until the operation reaches a terminal state. -type ServersClientRestartPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ServersClientRestartPoller) 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 *ServersClientRestartPoller) 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 ServersClientRestartResponse will be returned. -func (p *ServersClientRestartPoller) FinalResponse(ctx context.Context) (ServersClientRestartResponse, error) { - respType := ServersClientRestartResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return ServersClientRestartResponse{}, 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 *ServersClientRestartPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ServersClientStartPoller provides polling facilities until the operation reaches a terminal state. -type ServersClientStartPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ServersClientStartPoller) 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 *ServersClientStartPoller) 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 ServersClientStartResponse will be returned. -func (p *ServersClientStartPoller) FinalResponse(ctx context.Context) (ServersClientStartResponse, error) { - respType := ServersClientStartResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return ServersClientStartResponse{}, 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 *ServersClientStartPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ServersClientStopPoller provides polling facilities until the operation reaches a terminal state. -type ServersClientStopPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ServersClientStopPoller) 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 *ServersClientStopPoller) 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 ServersClientStopResponse will be returned. -func (p *ServersClientStopPoller) FinalResponse(ctx context.Context) (ServersClientStopResponse, error) { - respType := ServersClientStopResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return ServersClientStopResponse{}, 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 *ServersClientStopPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ServersClientUpdatePoller provides polling facilities until the operation reaches a terminal state. -type ServersClientUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ServersClientUpdatePoller) 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 *ServersClientUpdatePoller) 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 ServersClientUpdateResponse will be returned. -func (p *ServersClientUpdatePoller) FinalResponse(ctx context.Context) (ServersClientUpdateResponse, error) { - respType := ServersClientUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.Server) - if err != nil { - return ServersClientUpdateResponse{}, 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 *ServersClientUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// VirtualNetworkRulesClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type VirtualNetworkRulesClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VirtualNetworkRulesClientCreateOrUpdatePoller) 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 *VirtualNetworkRulesClientCreateOrUpdatePoller) 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 VirtualNetworkRulesClientCreateOrUpdateResponse will be returned. -func (p *VirtualNetworkRulesClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VirtualNetworkRulesClientCreateOrUpdateResponse, error) { - respType := VirtualNetworkRulesClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.VirtualNetworkRule) - if err != nil { - return VirtualNetworkRulesClientCreateOrUpdateResponse{}, 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 *VirtualNetworkRulesClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// VirtualNetworkRulesClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type VirtualNetworkRulesClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VirtualNetworkRulesClientDeletePoller) 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 *VirtualNetworkRulesClientDeletePoller) 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 VirtualNetworkRulesClientDeleteResponse will be returned. -func (p *VirtualNetworkRulesClientDeletePoller) FinalResponse(ctx context.Context) (VirtualNetworkRulesClientDeleteResponse, error) { - respType := VirtualNetworkRulesClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return VirtualNetworkRulesClientDeleteResponse{}, 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 *VirtualNetworkRulesClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_polymorphic_helpers.go index 542a170ee8b5..ad6eee99a4fb 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_polymorphic_helpers.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_privateendpointconnections_client.go index c770a0db543a..b1711ce4e024 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_privateendpointconnections_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type PrivateEndpointConnectionsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateEndpointConnectionsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. @@ -55,22 +60,16 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // serverName - The name of the server. // options - PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate // method. -func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters, options) - if err != nil { - return PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse{}, err - } - result := PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse{ - RawResponse: resp, +func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*armruntime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("PrivateEndpointConnectionsClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &PrivateEndpointConnectionsClientCreateOrUpdatePoller{ - pt: pt, - } - return result, nil } // CreateOrUpdate - Approve or reject a private endpoint connection with a given name. @@ -126,22 +125,16 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // serverName - The name of the server. // options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. -func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (PrivateEndpointConnectionsClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, privateEndpointConnectionName, options) - if err != nil { - return PrivateEndpointConnectionsClientDeletePollerResponse{}, err - } - result := PrivateEndpointConnectionsClientDeletePollerResponse{ - RawResponse: resp, +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*armruntime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("PrivateEndpointConnectionsClient.Delete", "", resp, client.pl) - if err != nil { - return PrivateEndpointConnectionsClientDeletePollerResponse{}, err - } - result.Poller = &PrivateEndpointConnectionsClientDeletePoller{ - pt: pt, - } - return result, nil } // Delete - Deletes a private endpoint connection with a given name. @@ -245,7 +238,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con // getHandleResponse handles the Get response. func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { - result := PrivateEndpointConnectionsClientGetResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } @@ -258,16 +251,32 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // serverName - The name of the server. // options - PrivateEndpointConnectionsClientListByServerOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByServer // method. -func (client *PrivateEndpointConnectionsClient) ListByServer(resourceGroupName string, serverName string, options *PrivateEndpointConnectionsClientListByServerOptions) *PrivateEndpointConnectionsClientListByServerPager { - return &PrivateEndpointConnectionsClientListByServerPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) +func (client *PrivateEndpointConnectionsClient) ListByServer(resourceGroupName string, serverName string, options *PrivateEndpointConnectionsClientListByServerOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[PrivateEndpointConnectionsClientListByServerResponse]{ + More: func(page PrivateEndpointConnectionsClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp PrivateEndpointConnectionsClientListByServerResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateEndpointConnectionListResult.NextLink) + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListByServerResponse) (PrivateEndpointConnectionsClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateEndpointConnectionsClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) }, - } + }) } // listByServerCreateRequest creates the ListByServer request. @@ -298,7 +307,7 @@ func (client *PrivateEndpointConnectionsClient) listByServerCreateRequest(ctx co // listByServerHandleResponse handles the ListByServer response. func (client *PrivateEndpointConnectionsClient) listByServerHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListByServerResponse, error) { - result := PrivateEndpointConnectionsClientListByServerResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { return PrivateEndpointConnectionsClientListByServerResponse{}, err } @@ -312,22 +321,16 @@ func (client *PrivateEndpointConnectionsClient) listByServerHandleResponse(resp // parameters - Parameters supplied to the Update private endpoint connection Tags operation. // options - PrivateEndpointConnectionsClientBeginUpdateTagsOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginUpdateTags // method. -func (client *PrivateEndpointConnectionsClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters TagsObject, options *PrivateEndpointConnectionsClientBeginUpdateTagsOptions) (PrivateEndpointConnectionsClientUpdateTagsPollerResponse, error) { - resp, err := client.updateTags(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters, options) - if err != nil { - return PrivateEndpointConnectionsClientUpdateTagsPollerResponse{}, err +func (client *PrivateEndpointConnectionsClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters TagsObject, options *PrivateEndpointConnectionsClientBeginUpdateTagsOptions) (*armruntime.Poller[PrivateEndpointConnectionsClientUpdateTagsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateTags(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[PrivateEndpointConnectionsClientUpdateTagsResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientUpdateTagsResponse](options.ResumeToken, client.pl, nil) } - result := PrivateEndpointConnectionsClientUpdateTagsPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("PrivateEndpointConnectionsClient.UpdateTags", "", resp, client.pl) - if err != nil { - return PrivateEndpointConnectionsClientUpdateTagsPollerResponse{}, err - } - result.Poller = &PrivateEndpointConnectionsClientUpdateTagsPoller{ - pt: pt, - } - return result, nil } // UpdateTags - Updates private endpoint connection with the specified tags. diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_privatelinkresources_client.go index 25d6f68931c8..93ca855207f2 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_privatelinkresources_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type PrivateLinkResourcesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateLinkResourcesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Gets a private link resource for MariaDB server. @@ -103,7 +108,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, // getHandleResponse handles the Get response. func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesClientGetResponse, error) { - result := PrivateLinkResourcesClientGetResponse{RawResponse: resp} + result := PrivateLinkResourcesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { return PrivateLinkResourcesClientGetResponse{}, err } @@ -116,16 +121,32 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // serverName - The name of the server. // options - PrivateLinkResourcesClientListByServerOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByServer // method. -func (client *PrivateLinkResourcesClient) ListByServer(resourceGroupName string, serverName string, options *PrivateLinkResourcesClientListByServerOptions) *PrivateLinkResourcesClientListByServerPager { - return &PrivateLinkResourcesClientListByServerPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) +func (client *PrivateLinkResourcesClient) ListByServer(resourceGroupName string, serverName string, options *PrivateLinkResourcesClientListByServerOptions) *runtime.Pager[PrivateLinkResourcesClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[PrivateLinkResourcesClientListByServerResponse]{ + More: func(page PrivateLinkResourcesClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp PrivateLinkResourcesClientListByServerResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkResourceListResult.NextLink) + Fetcher: func(ctx context.Context, page *PrivateLinkResourcesClientListByServerResponse) (PrivateLinkResourcesClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateLinkResourcesClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) }, - } + }) } // listByServerCreateRequest creates the ListByServer request. @@ -156,7 +177,7 @@ func (client *PrivateLinkResourcesClient) listByServerCreateRequest(ctx context. // listByServerHandleResponse handles the ListByServer response. func (client *PrivateLinkResourcesClient) listByServerHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListByServerResponse, error) { - result := PrivateLinkResourcesClientListByServerResponse{RawResponse: resp} + result := PrivateLinkResourcesClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { return PrivateLinkResourcesClientListByServerResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_querytexts_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_querytexts_client.go index 9e548e94c6ce..10f98c640623 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_querytexts_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_querytexts_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type QueryTextsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewQueryTextsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *QueryTextsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewQueryTextsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*QueryTextsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &QueryTextsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Retrieve the Query-Store query texts for the queryId. @@ -102,7 +107,7 @@ func (client *QueryTextsClient) getCreateRequest(ctx context.Context, resourceGr // getHandleResponse handles the Get response. func (client *QueryTextsClient) getHandleResponse(resp *http.Response) (QueryTextsClientGetResponse, error) { - result := QueryTextsClientGetResponse{RawResponse: resp} + result := QueryTextsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.QueryText); err != nil { return QueryTextsClientGetResponse{}, err } @@ -115,16 +120,32 @@ func (client *QueryTextsClient) getHandleResponse(resp *http.Response) (QueryTex // serverName - The name of the server. // queryIDs - The query identifiers // options - QueryTextsClientListByServerOptions contains the optional parameters for the QueryTextsClient.ListByServer method. -func (client *QueryTextsClient) ListByServer(resourceGroupName string, serverName string, queryIDs []string, options *QueryTextsClientListByServerOptions) *QueryTextsClientListByServerPager { - return &QueryTextsClientListByServerPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByServerCreateRequest(ctx, resourceGroupName, serverName, queryIDs, options) +func (client *QueryTextsClient) ListByServer(resourceGroupName string, serverName string, queryIDs []string, options *QueryTextsClientListByServerOptions) *runtime.Pager[QueryTextsClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[QueryTextsClientListByServerResponse]{ + More: func(page QueryTextsClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp QueryTextsClientListByServerResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.QueryTextsResultList.NextLink) + Fetcher: func(ctx context.Context, page *QueryTextsClientListByServerResponse) (QueryTextsClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, queryIDs, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return QueryTextsClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return QueryTextsClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return QueryTextsClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) }, - } + }) } // listByServerCreateRequest creates the ListByServer request. @@ -158,7 +179,7 @@ func (client *QueryTextsClient) listByServerCreateRequest(ctx context.Context, r // listByServerHandleResponse handles the ListByServer response. func (client *QueryTextsClient) listByServerHandleResponse(resp *http.Response) (QueryTextsClientListByServerResponse, error) { - result := QueryTextsClientListByServerResponse{RawResponse: resp} + result := QueryTextsClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.QueryTextsResultList); err != nil { return QueryTextsClientListByServerResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_recommendedactions_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_recommendedactions_client.go index 3764f8487d35..1ce3a4f68eaf 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_recommendedactions_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_recommendedactions_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type RecommendedActionsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewRecommendedActionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RecommendedActionsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewRecommendedActionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecommendedActionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &RecommendedActionsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Retrieve recommended actions from the advisor. @@ -107,7 +112,7 @@ func (client *RecommendedActionsClient) getCreateRequest(ctx context.Context, re // getHandleResponse handles the Get response. func (client *RecommendedActionsClient) getHandleResponse(resp *http.Response) (RecommendedActionsClientGetResponse, error) { - result := RecommendedActionsClientGetResponse{RawResponse: resp} + result := RecommendedActionsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendationAction); err != nil { return RecommendedActionsClientGetResponse{}, err } @@ -121,16 +126,32 @@ func (client *RecommendedActionsClient) getHandleResponse(resp *http.Response) ( // advisorName - The advisor name for recommendation action. // options - RecommendedActionsClientListByServerOptions contains the optional parameters for the RecommendedActionsClient.ListByServer // method. -func (client *RecommendedActionsClient) ListByServer(resourceGroupName string, serverName string, advisorName string, options *RecommendedActionsClientListByServerOptions) *RecommendedActionsClientListByServerPager { - return &RecommendedActionsClientListByServerPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByServerCreateRequest(ctx, resourceGroupName, serverName, advisorName, options) +func (client *RecommendedActionsClient) ListByServer(resourceGroupName string, serverName string, advisorName string, options *RecommendedActionsClientListByServerOptions) *runtime.Pager[RecommendedActionsClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[RecommendedActionsClientListByServerResponse]{ + More: func(page RecommendedActionsClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp RecommendedActionsClientListByServerResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.RecommendationActionsResultList.NextLink) + Fetcher: func(ctx context.Context, page *RecommendedActionsClientListByServerResponse) (RecommendedActionsClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, advisorName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RecommendedActionsClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RecommendedActionsClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RecommendedActionsClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) }, - } + }) } // listByServerCreateRequest creates the ListByServer request. @@ -168,7 +189,7 @@ func (client *RecommendedActionsClient) listByServerCreateRequest(ctx context.Co // listByServerHandleResponse handles the ListByServer response. func (client *RecommendedActionsClient) listByServerHandleResponse(resp *http.Response) (RecommendedActionsClientListByServerResponse, error) { - result := RecommendedActionsClientListByServerResponse{RawResponse: resp} + result := RecommendedActionsClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendationActionsResultList); err != nil { return RecommendedActionsClientListByServerResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_recoverableservers_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_recoverableservers_client.go index 0f10ee5edc11..0f414426ca37 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_recoverableservers_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_recoverableservers_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type RecoverableServersClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewRecoverableServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RecoverableServersClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewRecoverableServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecoverableServersClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &RecoverableServersClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Gets a recoverable MariaDB Server. @@ -97,7 +102,7 @@ func (client *RecoverableServersClient) getCreateRequest(ctx context.Context, re // getHandleResponse handles the Get response. func (client *RecoverableServersClient) getHandleResponse(resp *http.Response) (RecoverableServersClientGetResponse, error) { - result := RecoverableServersClientGetResponse{RawResponse: resp} + result := RecoverableServersClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RecoverableServerResource); err != nil { return RecoverableServersClientGetResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_replicas_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_replicas_client.go index de6f49c49608..7b2802760cc7 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_replicas_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_replicas_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ReplicasClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ReplicasClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicasClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ReplicasClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // ListByServer - List all the replicas for a given server. @@ -54,19 +59,26 @@ func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, // resourceGroupName - The name of the resource group. The name is case insensitive. // serverName - The name of the server. // options - ReplicasClientListByServerOptions contains the optional parameters for the ReplicasClient.ListByServer method. -func (client *ReplicasClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, options *ReplicasClientListByServerOptions) (ReplicasClientListByServerResponse, error) { - req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) - if err != nil { - return ReplicasClientListByServerResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ReplicasClientListByServerResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ReplicasClientListByServerResponse{}, runtime.NewResponseError(resp) - } - return client.listByServerHandleResponse(resp) +func (client *ReplicasClient) ListByServer(resourceGroupName string, serverName string, options *ReplicasClientListByServerOptions) *runtime.Pager[ReplicasClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[ReplicasClientListByServerResponse]{ + More: func(page ReplicasClientListByServerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ReplicasClientListByServerResponse) (ReplicasClientListByServerResponse, error) { + req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + if err != nil { + return ReplicasClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ReplicasClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ReplicasClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) + }, + }) } // listByServerCreateRequest creates the ListByServer request. @@ -97,7 +109,7 @@ func (client *ReplicasClient) listByServerCreateRequest(ctx context.Context, res // listByServerHandleResponse handles the ListByServer response. func (client *ReplicasClient) listByServerHandleResponse(resp *http.Response) (ReplicasClientListByServerResponse, error) { - result := ReplicasClientListByServerResponse{RawResponse: resp} + result := ReplicasClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { return ReplicasClientListByServerResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_response_types.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_response_types.go index de667b1f66cd..204047ec4f60 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_response_types.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,1387 +8,282 @@ package armmariadb -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - // AdvisorsClientGetResponse contains the response from method AdvisorsClient.Get. type AdvisorsClientGetResponse struct { - AdvisorsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AdvisorsClientGetResult contains the result from method AdvisorsClient.Get. -type AdvisorsClientGetResult struct { Advisor } // AdvisorsClientListByServerResponse contains the response from method AdvisorsClient.ListByServer. type AdvisorsClientListByServerResponse struct { - AdvisorsClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AdvisorsClientListByServerResult contains the result from method AdvisorsClient.ListByServer. -type AdvisorsClientListByServerResult struct { AdvisorsResultList } // CheckNameAvailabilityClientExecuteResponse contains the response from method CheckNameAvailabilityClient.Execute. type CheckNameAvailabilityClientExecuteResponse struct { - CheckNameAvailabilityClientExecuteResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CheckNameAvailabilityClientExecuteResult contains the result from method CheckNameAvailabilityClient.Execute. -type CheckNameAvailabilityClientExecuteResult struct { NameAvailability } -// ConfigurationsClientCreateOrUpdatePollerResponse contains the response from method ConfigurationsClient.CreateOrUpdate. -type ConfigurationsClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *ConfigurationsClientCreateOrUpdatePoller - - // 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 ConfigurationsClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConfigurationsClientCreateOrUpdateResponse, error) { - respType := ConfigurationsClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Configuration) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ConfigurationsClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *ConfigurationsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ConfigurationsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ConfigurationsClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &ConfigurationsClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ConfigurationsClientCreateOrUpdateResponse contains the response from method ConfigurationsClient.CreateOrUpdate. type ConfigurationsClientCreateOrUpdateResponse struct { - ConfigurationsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationsClientCreateOrUpdateResult contains the result from method ConfigurationsClient.CreateOrUpdate. -type ConfigurationsClientCreateOrUpdateResult struct { Configuration } // ConfigurationsClientGetResponse contains the response from method ConfigurationsClient.Get. type ConfigurationsClientGetResponse struct { - ConfigurationsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationsClientGetResult contains the result from method ConfigurationsClient.Get. -type ConfigurationsClientGetResult struct { Configuration } // ConfigurationsClientListByServerResponse contains the response from method ConfigurationsClient.ListByServer. type ConfigurationsClientListByServerResponse struct { - ConfigurationsClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ConfigurationsClientListByServerResult contains the result from method ConfigurationsClient.ListByServer. -type ConfigurationsClientListByServerResult struct { ConfigurationListResult } -// DatabasesClientCreateOrUpdatePollerResponse contains the response from method DatabasesClient.CreateOrUpdate. -type DatabasesClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *DatabasesClientCreateOrUpdatePoller - - // 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 DatabasesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesClientCreateOrUpdateResponse, error) { - respType := DatabasesClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Database) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a DatabasesClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *DatabasesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DatabasesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("DatabasesClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &DatabasesClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // DatabasesClientCreateOrUpdateResponse contains the response from method DatabasesClient.CreateOrUpdate. type DatabasesClientCreateOrUpdateResponse struct { - DatabasesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// DatabasesClientCreateOrUpdateResult contains the result from method DatabasesClient.CreateOrUpdate. -type DatabasesClientCreateOrUpdateResult struct { Database } -// DatabasesClientDeletePollerResponse contains the response from method DatabasesClient.Delete. -type DatabasesClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *DatabasesClientDeletePoller - - // 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 DatabasesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesClientDeleteResponse, error) { - respType := DatabasesClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a DatabasesClientDeletePollerResponse from the provided client and resume token. -func (l *DatabasesClientDeletePollerResponse) Resume(ctx context.Context, client *DatabasesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("DatabasesClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &DatabasesClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // DatabasesClientDeleteResponse contains the response from method DatabasesClient.Delete. type DatabasesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // DatabasesClientGetResponse contains the response from method DatabasesClient.Get. type DatabasesClientGetResponse struct { - DatabasesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// DatabasesClientGetResult contains the result from method DatabasesClient.Get. -type DatabasesClientGetResult struct { Database } // DatabasesClientListByServerResponse contains the response from method DatabasesClient.ListByServer. type DatabasesClientListByServerResponse struct { - DatabasesClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// DatabasesClientListByServerResult contains the result from method DatabasesClient.ListByServer. -type DatabasesClientListByServerResult struct { DatabaseListResult } -// FirewallRulesClientCreateOrUpdatePollerResponse contains the response from method FirewallRulesClient.CreateOrUpdate. -type FirewallRulesClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *FirewallRulesClientCreateOrUpdatePoller - - // 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 FirewallRulesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallRulesClientCreateOrUpdateResponse, error) { - respType := FirewallRulesClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FirewallRule) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a FirewallRulesClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *FirewallRulesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *FirewallRulesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("FirewallRulesClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &FirewallRulesClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // FirewallRulesClientCreateOrUpdateResponse contains the response from method FirewallRulesClient.CreateOrUpdate. type FirewallRulesClientCreateOrUpdateResponse struct { - FirewallRulesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// FirewallRulesClientCreateOrUpdateResult contains the result from method FirewallRulesClient.CreateOrUpdate. -type FirewallRulesClientCreateOrUpdateResult struct { FirewallRule } -// FirewallRulesClientDeletePollerResponse contains the response from method FirewallRulesClient.Delete. -type FirewallRulesClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *FirewallRulesClientDeletePoller - - // 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 FirewallRulesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallRulesClientDeleteResponse, error) { - respType := FirewallRulesClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a FirewallRulesClientDeletePollerResponse from the provided client and resume token. -func (l *FirewallRulesClientDeletePollerResponse) Resume(ctx context.Context, client *FirewallRulesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("FirewallRulesClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &FirewallRulesClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // FirewallRulesClientDeleteResponse contains the response from method FirewallRulesClient.Delete. type FirewallRulesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // FirewallRulesClientGetResponse contains the response from method FirewallRulesClient.Get. type FirewallRulesClientGetResponse struct { - FirewallRulesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// FirewallRulesClientGetResult contains the result from method FirewallRulesClient.Get. -type FirewallRulesClientGetResult struct { FirewallRule } // FirewallRulesClientListByServerResponse contains the response from method FirewallRulesClient.ListByServer. type FirewallRulesClientListByServerResponse struct { - FirewallRulesClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// FirewallRulesClientListByServerResult contains the result from method FirewallRulesClient.ListByServer. -type FirewallRulesClientListByServerResult struct { FirewallRuleListResult } // LocationBasedPerformanceTierClientListResponse contains the response from method LocationBasedPerformanceTierClient.List. type LocationBasedPerformanceTierClientListResponse struct { - LocationBasedPerformanceTierClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LocationBasedPerformanceTierClientListResult contains the result from method LocationBasedPerformanceTierClient.List. -type LocationBasedPerformanceTierClientListResult struct { PerformanceTierListResult } // LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse contains the response from method LocationBasedRecommendedActionSessionsOperationStatusClient.Get. type LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse struct { - LocationBasedRecommendedActionSessionsOperationStatusClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LocationBasedRecommendedActionSessionsOperationStatusClientGetResult contains the result from method LocationBasedRecommendedActionSessionsOperationStatusClient.Get. -type LocationBasedRecommendedActionSessionsOperationStatusClientGetResult struct { RecommendedActionSessionsOperationStatus } // LocationBasedRecommendedActionSessionsResultClientListResponse contains the response from method LocationBasedRecommendedActionSessionsResultClient.List. type LocationBasedRecommendedActionSessionsResultClientListResponse struct { - LocationBasedRecommendedActionSessionsResultClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LocationBasedRecommendedActionSessionsResultClientListResult contains the result from method LocationBasedRecommendedActionSessionsResultClient.List. -type LocationBasedRecommendedActionSessionsResultClientListResult struct { RecommendationActionsResultList } // LogFilesClientListByServerResponse contains the response from method LogFilesClient.ListByServer. type LogFilesClientListByServerResponse struct { - LogFilesClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LogFilesClientListByServerResult contains the result from method LogFilesClient.ListByServer. -type LogFilesClientListByServerResult struct { LogFileListResult } -// ManagementClientCreateRecommendedActionSessionPollerResponse contains the response from method ManagementClient.CreateRecommendedActionSession. -type ManagementClientCreateRecommendedActionSessionPollerResponse struct { - // Poller contains an initialized poller. - Poller *ManagementClientCreateRecommendedActionSessionPoller - - // 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 ManagementClientCreateRecommendedActionSessionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagementClientCreateRecommendedActionSessionResponse, error) { - respType := ManagementClientCreateRecommendedActionSessionResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ManagementClientCreateRecommendedActionSessionPollerResponse from the provided client and resume token. -func (l *ManagementClientCreateRecommendedActionSessionPollerResponse) Resume(ctx context.Context, client *ManagementClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ManagementClient.CreateRecommendedActionSession", token, client.pl) - if err != nil { - return err - } - poller := &ManagementClientCreateRecommendedActionSessionPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ManagementClientCreateRecommendedActionSessionResponse contains the response from method ManagementClient.CreateRecommendedActionSession. type ManagementClientCreateRecommendedActionSessionResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // ManagementClientResetQueryPerformanceInsightDataResponse contains the response from method ManagementClient.ResetQueryPerformanceInsightData. type ManagementClientResetQueryPerformanceInsightDataResponse struct { - ManagementClientResetQueryPerformanceInsightDataResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ManagementClientResetQueryPerformanceInsightDataResult contains the result from method ManagementClient.ResetQueryPerformanceInsightData. -type ManagementClientResetQueryPerformanceInsightDataResult struct { QueryPerformanceInsightResetDataResult } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationListResult } -// PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse contains the response from method PrivateEndpointConnectionsClient.CreateOrUpdate. -type PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *PrivateEndpointConnectionsClientCreateOrUpdatePoller - - // 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 PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error) { - respType := PrivateEndpointConnectionsClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &PrivateEndpointConnectionsClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.CreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { - PrivateEndpointConnectionsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientCreateOrUpdateResult contains the result from method PrivateEndpointConnectionsClient.CreateOrUpdate. -type PrivateEndpointConnectionsClientCreateOrUpdateResult struct { PrivateEndpointConnection } -// PrivateEndpointConnectionsClientDeletePollerResponse contains the response from method PrivateEndpointConnectionsClient.Delete. -type PrivateEndpointConnectionsClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *PrivateEndpointConnectionsClientDeletePoller - - // 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 PrivateEndpointConnectionsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsClientDeleteResponse, error) { - respType := PrivateEndpointConnectionsClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PrivateEndpointConnectionsClientDeletePollerResponse from the provided client and resume token. -func (l *PrivateEndpointConnectionsClientDeletePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &PrivateEndpointConnectionsClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. type PrivateEndpointConnectionsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { - PrivateEndpointConnectionsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientGetResult contains the result from method PrivateEndpointConnectionsClient.Get. -type PrivateEndpointConnectionsClientGetResult struct { PrivateEndpointConnection } // PrivateEndpointConnectionsClientListByServerResponse contains the response from method PrivateEndpointConnectionsClient.ListByServer. type PrivateEndpointConnectionsClientListByServerResponse struct { - PrivateEndpointConnectionsClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientListByServerResult contains the result from method PrivateEndpointConnectionsClient.ListByServer. -type PrivateEndpointConnectionsClientListByServerResult struct { PrivateEndpointConnectionListResult } -// PrivateEndpointConnectionsClientUpdateTagsPollerResponse contains the response from method PrivateEndpointConnectionsClient.UpdateTags. -type PrivateEndpointConnectionsClientUpdateTagsPollerResponse struct { - // Poller contains an initialized poller. - Poller *PrivateEndpointConnectionsClientUpdateTagsPoller - - // 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 PrivateEndpointConnectionsClientUpdateTagsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsClientUpdateTagsResponse, error) { - respType := PrivateEndpointConnectionsClientUpdateTagsResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PrivateEndpointConnectionsClientUpdateTagsPollerResponse from the provided client and resume token. -func (l *PrivateEndpointConnectionsClientUpdateTagsPollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsClient.UpdateTags", token, client.pl) - if err != nil { - return err - } - poller := &PrivateEndpointConnectionsClientUpdateTagsPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // PrivateEndpointConnectionsClientUpdateTagsResponse contains the response from method PrivateEndpointConnectionsClient.UpdateTags. type PrivateEndpointConnectionsClientUpdateTagsResponse struct { - PrivateEndpointConnectionsClientUpdateTagsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientUpdateTagsResult contains the result from method PrivateEndpointConnectionsClient.UpdateTags. -type PrivateEndpointConnectionsClientUpdateTagsResult struct { PrivateEndpointConnection } // PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. type PrivateLinkResourcesClientGetResponse struct { - PrivateLinkResourcesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateLinkResourcesClientGetResult contains the result from method PrivateLinkResourcesClient.Get. -type PrivateLinkResourcesClientGetResult struct { PrivateLinkResource } // PrivateLinkResourcesClientListByServerResponse contains the response from method PrivateLinkResourcesClient.ListByServer. type PrivateLinkResourcesClientListByServerResponse struct { - PrivateLinkResourcesClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateLinkResourcesClientListByServerResult contains the result from method PrivateLinkResourcesClient.ListByServer. -type PrivateLinkResourcesClientListByServerResult struct { PrivateLinkResourceListResult } // QueryTextsClientGetResponse contains the response from method QueryTextsClient.Get. type QueryTextsClientGetResponse struct { - QueryTextsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// QueryTextsClientGetResult contains the result from method QueryTextsClient.Get. -type QueryTextsClientGetResult struct { QueryText } // QueryTextsClientListByServerResponse contains the response from method QueryTextsClient.ListByServer. type QueryTextsClientListByServerResponse struct { - QueryTextsClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// QueryTextsClientListByServerResult contains the result from method QueryTextsClient.ListByServer. -type QueryTextsClientListByServerResult struct { QueryTextsResultList } // RecommendedActionsClientGetResponse contains the response from method RecommendedActionsClient.Get. type RecommendedActionsClientGetResponse struct { - RecommendedActionsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// RecommendedActionsClientGetResult contains the result from method RecommendedActionsClient.Get. -type RecommendedActionsClientGetResult struct { RecommendationAction } // RecommendedActionsClientListByServerResponse contains the response from method RecommendedActionsClient.ListByServer. type RecommendedActionsClientListByServerResponse struct { - RecommendedActionsClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// RecommendedActionsClientListByServerResult contains the result from method RecommendedActionsClient.ListByServer. -type RecommendedActionsClientListByServerResult struct { RecommendationActionsResultList } // RecoverableServersClientGetResponse contains the response from method RecoverableServersClient.Get. type RecoverableServersClientGetResponse struct { - RecoverableServersClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// RecoverableServersClientGetResult contains the result from method RecoverableServersClient.Get. -type RecoverableServersClientGetResult struct { RecoverableServerResource } // ReplicasClientListByServerResponse contains the response from method ReplicasClient.ListByServer. type ReplicasClientListByServerResponse struct { - ReplicasClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ReplicasClientListByServerResult contains the result from method ReplicasClient.ListByServer. -type ReplicasClientListByServerResult struct { ServerListResult } // ServerBasedPerformanceTierClientListResponse contains the response from method ServerBasedPerformanceTierClient.List. type ServerBasedPerformanceTierClientListResponse struct { - ServerBasedPerformanceTierClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServerBasedPerformanceTierClientListResult contains the result from method ServerBasedPerformanceTierClient.List. -type ServerBasedPerformanceTierClientListResult struct { PerformanceTierListResult } -// ServerParametersClientListUpdateConfigurationsPollerResponse contains the response from method ServerParametersClient.ListUpdateConfigurations. -type ServerParametersClientListUpdateConfigurationsPollerResponse struct { - // Poller contains an initialized poller. - Poller *ServerParametersClientListUpdateConfigurationsPoller - - // 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 ServerParametersClientListUpdateConfigurationsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerParametersClientListUpdateConfigurationsResponse, error) { - respType := ServerParametersClientListUpdateConfigurationsResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConfigurationListResult) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ServerParametersClientListUpdateConfigurationsPollerResponse from the provided client and resume token. -func (l *ServerParametersClientListUpdateConfigurationsPollerResponse) Resume(ctx context.Context, client *ServerParametersClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ServerParametersClient.ListUpdateConfigurations", token, client.pl) - if err != nil { - return err - } - poller := &ServerParametersClientListUpdateConfigurationsPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ServerParametersClientListUpdateConfigurationsResponse contains the response from method ServerParametersClient.ListUpdateConfigurations. type ServerParametersClientListUpdateConfigurationsResponse struct { - ServerParametersClientListUpdateConfigurationsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServerParametersClientListUpdateConfigurationsResult contains the result from method ServerParametersClient.ListUpdateConfigurations. -type ServerParametersClientListUpdateConfigurationsResult struct { ConfigurationListResult } -// ServerSecurityAlertPoliciesClientCreateOrUpdatePollerResponse contains the response from method ServerSecurityAlertPoliciesClient.CreateOrUpdate. -type ServerSecurityAlertPoliciesClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *ServerSecurityAlertPoliciesClientCreateOrUpdatePoller - - // 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 ServerSecurityAlertPoliciesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerSecurityAlertPoliciesClientCreateOrUpdateResponse, error) { - respType := ServerSecurityAlertPoliciesClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerSecurityAlertPolicy) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ServerSecurityAlertPoliciesClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *ServerSecurityAlertPoliciesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ServerSecurityAlertPoliciesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ServerSecurityAlertPoliciesClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &ServerSecurityAlertPoliciesClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ServerSecurityAlertPoliciesClientCreateOrUpdateResponse contains the response from method ServerSecurityAlertPoliciesClient.CreateOrUpdate. type ServerSecurityAlertPoliciesClientCreateOrUpdateResponse struct { - ServerSecurityAlertPoliciesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServerSecurityAlertPoliciesClientCreateOrUpdateResult contains the result from method ServerSecurityAlertPoliciesClient.CreateOrUpdate. -type ServerSecurityAlertPoliciesClientCreateOrUpdateResult struct { ServerSecurityAlertPolicy } // ServerSecurityAlertPoliciesClientGetResponse contains the response from method ServerSecurityAlertPoliciesClient.Get. type ServerSecurityAlertPoliciesClientGetResponse struct { - ServerSecurityAlertPoliciesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServerSecurityAlertPoliciesClientGetResult contains the result from method ServerSecurityAlertPoliciesClient.Get. -type ServerSecurityAlertPoliciesClientGetResult struct { ServerSecurityAlertPolicy } // ServerSecurityAlertPoliciesClientListByServerResponse contains the response from method ServerSecurityAlertPoliciesClient.ListByServer. type ServerSecurityAlertPoliciesClientListByServerResponse struct { - ServerSecurityAlertPoliciesClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServerSecurityAlertPoliciesClientListByServerResult contains the result from method ServerSecurityAlertPoliciesClient.ListByServer. -type ServerSecurityAlertPoliciesClientListByServerResult struct { ServerSecurityAlertPolicyListResult } -// ServersClientCreatePollerResponse contains the response from method ServersClient.Create. -type ServersClientCreatePollerResponse struct { - // Poller contains an initialized poller. - Poller *ServersClientCreatePoller - - // 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 ServersClientCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersClientCreateResponse, error) { - respType := ServersClientCreateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Server) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ServersClientCreatePollerResponse from the provided client and resume token. -func (l *ServersClientCreatePollerResponse) Resume(ctx context.Context, client *ServersClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ServersClient.Create", token, client.pl) - if err != nil { - return err - } - poller := &ServersClientCreatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ServersClientCreateResponse contains the response from method ServersClient.Create. type ServersClientCreateResponse struct { - ServersClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServersClientCreateResult contains the result from method ServersClient.Create. -type ServersClientCreateResult struct { Server } -// ServersClientDeletePollerResponse contains the response from method ServersClient.Delete. -type ServersClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *ServersClientDeletePoller - - // 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 ServersClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersClientDeleteResponse, error) { - respType := ServersClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ServersClientDeletePollerResponse from the provided client and resume token. -func (l *ServersClientDeletePollerResponse) Resume(ctx context.Context, client *ServersClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ServersClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &ServersClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ServersClientDeleteResponse contains the response from method ServersClient.Delete. type ServersClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // ServersClientGetResponse contains the response from method ServersClient.Get. type ServersClientGetResponse struct { - ServersClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServersClientGetResult contains the result from method ServersClient.Get. -type ServersClientGetResult struct { Server } // ServersClientListByResourceGroupResponse contains the response from method ServersClient.ListByResourceGroup. type ServersClientListByResourceGroupResponse struct { - ServersClientListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServersClientListByResourceGroupResult contains the result from method ServersClient.ListByResourceGroup. -type ServersClientListByResourceGroupResult struct { ServerListResult } // ServersClientListResponse contains the response from method ServersClient.List. type ServersClientListResponse struct { - ServersClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServersClientListResult contains the result from method ServersClient.List. -type ServersClientListResult struct { ServerListResult } -// ServersClientRestartPollerResponse contains the response from method ServersClient.Restart. -type ServersClientRestartPollerResponse struct { - // Poller contains an initialized poller. - Poller *ServersClientRestartPoller - - // 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 ServersClientRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersClientRestartResponse, error) { - respType := ServersClientRestartResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ServersClientRestartPollerResponse from the provided client and resume token. -func (l *ServersClientRestartPollerResponse) Resume(ctx context.Context, client *ServersClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ServersClient.Restart", token, client.pl) - if err != nil { - return err - } - poller := &ServersClientRestartPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ServersClientRestartResponse contains the response from method ServersClient.Restart. type ServersClientRestartResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServersClientStartPollerResponse contains the response from method ServersClient.Start. -type ServersClientStartPollerResponse struct { - // Poller contains an initialized poller. - Poller *ServersClientStartPoller - - // 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 ServersClientStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersClientStartResponse, error) { - respType := ServersClientStartResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ServersClientStartPollerResponse from the provided client and resume token. -func (l *ServersClientStartPollerResponse) Resume(ctx context.Context, client *ServersClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ServersClient.Start", token, client.pl) - if err != nil { - return err - } - poller := &ServersClientStartPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // ServersClientStartResponse contains the response from method ServersClient.Start. type ServersClientStartResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServersClientStopPollerResponse contains the response from method ServersClient.Stop. -type ServersClientStopPollerResponse struct { - // Poller contains an initialized poller. - Poller *ServersClientStopPoller - - // 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 ServersClientStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersClientStopResponse, error) { - respType := ServersClientStopResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ServersClientStopPollerResponse from the provided client and resume token. -func (l *ServersClientStopPollerResponse) Resume(ctx context.Context, client *ServersClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ServersClient.Stop", token, client.pl) - if err != nil { - return err - } - poller := &ServersClientStopPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // ServersClientStopResponse contains the response from method ServersClient.Stop. type ServersClientStopResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServersClientUpdatePollerResponse contains the response from method ServersClient.Update. -type ServersClientUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *ServersClientUpdatePoller - - // 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 ServersClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersClientUpdateResponse, error) { - respType := ServersClientUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Server) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ServersClientUpdatePollerResponse from the provided client and resume token. -func (l *ServersClientUpdatePollerResponse) Resume(ctx context.Context, client *ServersClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ServersClient.Update", token, client.pl) - if err != nil { - return err - } - poller := &ServersClientUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // ServersClientUpdateResponse contains the response from method ServersClient.Update. type ServersClientUpdateResponse struct { - ServersClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServersClientUpdateResult contains the result from method ServersClient.Update. -type ServersClientUpdateResult struct { Server } // TopQueryStatisticsClientGetResponse contains the response from method TopQueryStatisticsClient.Get. type TopQueryStatisticsClientGetResponse struct { - TopQueryStatisticsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// TopQueryStatisticsClientGetResult contains the result from method TopQueryStatisticsClient.Get. -type TopQueryStatisticsClientGetResult struct { QueryStatistic } // TopQueryStatisticsClientListByServerResponse contains the response from method TopQueryStatisticsClient.ListByServer. type TopQueryStatisticsClientListByServerResponse struct { - TopQueryStatisticsClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// TopQueryStatisticsClientListByServerResult contains the result from method TopQueryStatisticsClient.ListByServer. -type TopQueryStatisticsClientListByServerResult struct { TopQueryStatisticsResultList } -// VirtualNetworkRulesClientCreateOrUpdatePollerResponse contains the response from method VirtualNetworkRulesClient.CreateOrUpdate. -type VirtualNetworkRulesClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *VirtualNetworkRulesClientCreateOrUpdatePoller - - // 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 VirtualNetworkRulesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkRulesClientCreateOrUpdateResponse, error) { - respType := VirtualNetworkRulesClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkRule) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VirtualNetworkRulesClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *VirtualNetworkRulesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualNetworkRulesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VirtualNetworkRulesClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &VirtualNetworkRulesClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // VirtualNetworkRulesClientCreateOrUpdateResponse contains the response from method VirtualNetworkRulesClient.CreateOrUpdate. type VirtualNetworkRulesClientCreateOrUpdateResponse struct { - VirtualNetworkRulesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualNetworkRulesClientCreateOrUpdateResult contains the result from method VirtualNetworkRulesClient.CreateOrUpdate. -type VirtualNetworkRulesClientCreateOrUpdateResult struct { VirtualNetworkRule } -// VirtualNetworkRulesClientDeletePollerResponse contains the response from method VirtualNetworkRulesClient.Delete. -type VirtualNetworkRulesClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *VirtualNetworkRulesClientDeletePoller - - // 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 VirtualNetworkRulesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkRulesClientDeleteResponse, error) { - respType := VirtualNetworkRulesClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VirtualNetworkRulesClientDeletePollerResponse from the provided client and resume token. -func (l *VirtualNetworkRulesClientDeletePollerResponse) Resume(ctx context.Context, client *VirtualNetworkRulesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VirtualNetworkRulesClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &VirtualNetworkRulesClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // VirtualNetworkRulesClientDeleteResponse contains the response from method VirtualNetworkRulesClient.Delete. type VirtualNetworkRulesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // VirtualNetworkRulesClientGetResponse contains the response from method VirtualNetworkRulesClient.Get. type VirtualNetworkRulesClientGetResponse struct { - VirtualNetworkRulesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualNetworkRulesClientGetResult contains the result from method VirtualNetworkRulesClient.Get. -type VirtualNetworkRulesClientGetResult struct { VirtualNetworkRule } // VirtualNetworkRulesClientListByServerResponse contains the response from method VirtualNetworkRulesClient.ListByServer. type VirtualNetworkRulesClientListByServerResponse struct { - VirtualNetworkRulesClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualNetworkRulesClientListByServerResult contains the result from method VirtualNetworkRulesClient.ListByServer. -type VirtualNetworkRulesClientListByServerResult struct { VirtualNetworkRuleListResult } // WaitStatisticsClientGetResponse contains the response from method WaitStatisticsClient.Get. type WaitStatisticsClientGetResponse struct { - WaitStatisticsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WaitStatisticsClientGetResult contains the result from method WaitStatisticsClient.Get. -type WaitStatisticsClientGetResult struct { WaitStatistic } // WaitStatisticsClientListByServerResponse contains the response from method WaitStatisticsClient.ListByServer. type WaitStatisticsClientListByServerResponse struct { - WaitStatisticsClientListByServerResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// WaitStatisticsClientListByServerResult contains the result from method WaitStatisticsClient.ListByServer. -type WaitStatisticsClientListByServerResult struct { WaitStatisticsResultList } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_serverbasedperformancetier_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_serverbasedperformancetier_client.go index 6bfe1c234be3..63b117bfe059 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_serverbasedperformancetier_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_serverbasedperformancetier_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ServerBasedPerformanceTierClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewServerBasedPerformanceTierClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerBasedPerformanceTierClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewServerBasedPerformanceTierClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerBasedPerformanceTierClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ServerBasedPerformanceTierClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - List all the performance tiers for a MariaDB server. @@ -55,19 +60,26 @@ func NewServerBasedPerformanceTierClient(subscriptionID string, credential azcor // serverName - The name of the server. // options - ServerBasedPerformanceTierClientListOptions contains the optional parameters for the ServerBasedPerformanceTierClient.List // method. -func (client *ServerBasedPerformanceTierClient) List(ctx context.Context, resourceGroupName string, serverName string, options *ServerBasedPerformanceTierClientListOptions) (ServerBasedPerformanceTierClientListResponse, error) { - req, err := client.listCreateRequest(ctx, resourceGroupName, serverName, options) - if err != nil { - return ServerBasedPerformanceTierClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ServerBasedPerformanceTierClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerBasedPerformanceTierClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *ServerBasedPerformanceTierClient) List(resourceGroupName string, serverName string, options *ServerBasedPerformanceTierClientListOptions) *runtime.Pager[ServerBasedPerformanceTierClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ServerBasedPerformanceTierClientListResponse]{ + More: func(page ServerBasedPerformanceTierClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ServerBasedPerformanceTierClientListResponse) (ServerBasedPerformanceTierClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, serverName, options) + if err != nil { + return ServerBasedPerformanceTierClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServerBasedPerformanceTierClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServerBasedPerformanceTierClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -98,7 +110,7 @@ func (client *ServerBasedPerformanceTierClient) listCreateRequest(ctx context.Co // listHandleResponse handles the List response. func (client *ServerBasedPerformanceTierClient) listHandleResponse(resp *http.Response) (ServerBasedPerformanceTierClientListResponse, error) { - result := ServerBasedPerformanceTierClientListResponse{RawResponse: resp} + result := ServerBasedPerformanceTierClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PerformanceTierListResult); err != nil { return ServerBasedPerformanceTierClientListResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_serverparameters_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_serverparameters_client.go index 162f7f3eae13..29a14ec018ed 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_serverparameters_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_serverparameters_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ServerParametersClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewServerParametersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerParametersClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewServerParametersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerParametersClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ServerParametersClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginListUpdateConfigurations - Update a list of configurations in a given server. @@ -56,22 +61,18 @@ func NewServerParametersClient(subscriptionID string, credential azcore.TokenCre // value - The parameters for updating a list of server configuration. // options - ServerParametersClientBeginListUpdateConfigurationsOptions contains the optional parameters for the ServerParametersClient.BeginListUpdateConfigurations // method. -func (client *ServerParametersClient) BeginListUpdateConfigurations(ctx context.Context, resourceGroupName string, serverName string, value ConfigurationListResult, options *ServerParametersClientBeginListUpdateConfigurationsOptions) (ServerParametersClientListUpdateConfigurationsPollerResponse, error) { - resp, err := client.listUpdateConfigurations(ctx, resourceGroupName, serverName, value, options) - if err != nil { - return ServerParametersClientListUpdateConfigurationsPollerResponse{}, err - } - result := ServerParametersClientListUpdateConfigurationsPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("ServerParametersClient.ListUpdateConfigurations", "azure-async-operation", resp, client.pl) - if err != nil { - return ServerParametersClientListUpdateConfigurationsPollerResponse{}, err - } - result.Poller = &ServerParametersClientListUpdateConfigurationsPoller{ - pt: pt, +func (client *ServerParametersClient) BeginListUpdateConfigurations(ctx context.Context, resourceGroupName string, serverName string, value ConfigurationListResult, options *ServerParametersClientBeginListUpdateConfigurationsOptions) (*armruntime.Poller[ServerParametersClientListUpdateConfigurationsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listUpdateConfigurations(ctx, resourceGroupName, serverName, value, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[ServerParametersClientListUpdateConfigurationsResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[ServerParametersClientListUpdateConfigurationsResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // ListUpdateConfigurations - Update a list of configurations in a given server. diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_servers_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_servers_client.go index 59be1a6cc414..104460b6cef8 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_servers_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_servers_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ServersClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServersClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServersClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ServersClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreate - Creates a new server or updates an existing server. The update action will overwrite the existing server. @@ -55,22 +60,16 @@ func NewServersClient(subscriptionID string, credential azcore.TokenCredential, // serverName - The name of the server. // parameters - The required parameters for creating or updating a server. // options - ServersClientBeginCreateOptions contains the optional parameters for the ServersClient.BeginCreate method. -func (client *ServersClient) BeginCreate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate, options *ServersClientBeginCreateOptions) (ServersClientCreatePollerResponse, error) { - resp, err := client.create(ctx, resourceGroupName, serverName, parameters, options) - if err != nil { - return ServersClientCreatePollerResponse{}, err - } - result := ServersClientCreatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("ServersClient.Create", "", resp, client.pl) - if err != nil { - return ServersClientCreatePollerResponse{}, err - } - result.Poller = &ServersClientCreatePoller{ - pt: pt, +func (client *ServersClient) BeginCreate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate, options *ServersClientBeginCreateOptions) (*armruntime.Poller[ServersClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, serverName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ServersClientCreateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ServersClientCreateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Create - Creates a new server or updates an existing server. The update action will overwrite the existing server. @@ -121,22 +120,16 @@ func (client *ServersClient) createCreateRequest(ctx context.Context, resourceGr // resourceGroupName - The name of the resource group. The name is case insensitive. // serverName - The name of the server. // options - ServersClientBeginDeleteOptions contains the optional parameters for the ServersClient.BeginDelete method. -func (client *ServersClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginDeleteOptions) (ServersClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, options) - if err != nil { - return ServersClientDeletePollerResponse{}, err +func (client *ServersClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginDeleteOptions) (*armruntime.Poller[ServersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ServersClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ServersClientDeleteResponse](options.ResumeToken, client.pl, nil) } - result := ServersClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("ServersClient.Delete", "", resp, client.pl) - if err != nil { - return ServersClientDeletePollerResponse{}, err - } - result.Poller = &ServersClientDeletePoller{ - pt: pt, - } - return result, nil } // Delete - Deletes a server. @@ -230,7 +223,7 @@ func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroup // getHandleResponse handles the Get response. func (client *ServersClient) getHandleResponse(resp *http.Response) (ServersClientGetResponse, error) { - result := ServersClientGetResponse{RawResponse: resp} + result := ServersClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Server); err != nil { return ServersClientGetResponse{}, err } @@ -240,19 +233,26 @@ func (client *ServersClient) getHandleResponse(resp *http.Response) (ServersClie // List - List all the servers in a given subscription. // If the operation fails it returns an *azcore.ResponseError type. // options - ServersClientListOptions contains the optional parameters for the ServersClient.List method. -func (client *ServersClient) List(ctx context.Context, options *ServersClientListOptions) (ServersClientListResponse, error) { - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return ServersClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ServersClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServersClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *ServersClient) List(options *ServersClientListOptions) *runtime.Pager[ServersClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ServersClientListResponse]{ + More: func(page ServersClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ServersClientListResponse) (ServersClientListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return ServersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -275,7 +275,7 @@ func (client *ServersClient) listCreateRequest(ctx context.Context, options *Ser // listHandleResponse handles the List response. func (client *ServersClient) listHandleResponse(resp *http.Response) (ServersClientListResponse, error) { - result := ServersClientListResponse{RawResponse: resp} + result := ServersClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { return ServersClientListResponse{}, err } @@ -287,19 +287,26 @@ func (client *ServersClient) listHandleResponse(resp *http.Response) (ServersCli // resourceGroupName - The name of the resource group. The name is case insensitive. // options - ServersClientListByResourceGroupOptions contains the optional parameters for the ServersClient.ListByResourceGroup // method. -func (client *ServersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, options *ServersClientListByResourceGroupOptions) (ServersClientListByResourceGroupResponse, error) { - req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - if err != nil { - return ServersClientListByResourceGroupResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ServersClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServersClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(resp) +func (client *ServersClient) ListByResourceGroup(resourceGroupName string, options *ServersClientListByResourceGroupOptions) *runtime.Pager[ServersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[ServersClientListByResourceGroupResponse]{ + More: func(page ServersClientListByResourceGroupResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ServersClientListByResourceGroupResponse) (ServersClientListByResourceGroupResponse, error) { + req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return ServersClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServersClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServersClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. @@ -326,7 +333,7 @@ func (client *ServersClient) listByResourceGroupCreateRequest(ctx context.Contex // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *ServersClient) listByResourceGroupHandleResponse(resp *http.Response) (ServersClientListByResourceGroupResponse, error) { - result := ServersClientListByResourceGroupResponse{RawResponse: resp} + result := ServersClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { return ServersClientListByResourceGroupResponse{}, err } @@ -338,22 +345,16 @@ func (client *ServersClient) listByResourceGroupHandleResponse(resp *http.Respon // resourceGroupName - The name of the resource group. The name is case insensitive. // serverName - The name of the server. // options - ServersClientBeginRestartOptions contains the optional parameters for the ServersClient.BeginRestart method. -func (client *ServersClient) BeginRestart(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginRestartOptions) (ServersClientRestartPollerResponse, error) { - resp, err := client.restart(ctx, resourceGroupName, serverName, options) - if err != nil { - return ServersClientRestartPollerResponse{}, err - } - result := ServersClientRestartPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("ServersClient.Restart", "", resp, client.pl) - if err != nil { - return ServersClientRestartPollerResponse{}, err - } - result.Poller = &ServersClientRestartPoller{ - pt: pt, +func (client *ServersClient) BeginRestart(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginRestartOptions) (*armruntime.Poller[ServersClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, serverName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ServersClientRestartResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ServersClientRestartResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Restart - Restarts a server. @@ -404,22 +405,16 @@ func (client *ServersClient) restartCreateRequest(ctx context.Context, resourceG // resourceGroupName - The name of the resource group. The name is case insensitive. // serverName - The name of the server. // options - ServersClientBeginStartOptions contains the optional parameters for the ServersClient.BeginStart method. -func (client *ServersClient) BeginStart(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStartOptions) (ServersClientStartPollerResponse, error) { - resp, err := client.start(ctx, resourceGroupName, serverName, options) - if err != nil { - return ServersClientStartPollerResponse{}, err - } - result := ServersClientStartPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("ServersClient.Start", "", resp, client.pl) - if err != nil { - return ServersClientStartPollerResponse{}, err +func (client *ServersClient) BeginStart(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStartOptions) (*armruntime.Poller[ServersClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, serverName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ServersClientStartResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ServersClientStartResponse](options.ResumeToken, client.pl, nil) } - result.Poller = &ServersClientStartPoller{ - pt: pt, - } - return result, nil } // Start - Starts a stopped server. @@ -470,22 +465,16 @@ func (client *ServersClient) startCreateRequest(ctx context.Context, resourceGro // resourceGroupName - The name of the resource group. The name is case insensitive. // serverName - The name of the server. // options - ServersClientBeginStopOptions contains the optional parameters for the ServersClient.BeginStop method. -func (client *ServersClient) BeginStop(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStopOptions) (ServersClientStopPollerResponse, error) { - resp, err := client.stop(ctx, resourceGroupName, serverName, options) - if err != nil { - return ServersClientStopPollerResponse{}, err - } - result := ServersClientStopPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("ServersClient.Stop", "", resp, client.pl) - if err != nil { - return ServersClientStopPollerResponse{}, err - } - result.Poller = &ServersClientStopPoller{ - pt: pt, +func (client *ServersClient) BeginStop(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStopOptions) (*armruntime.Poller[ServersClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, serverName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ServersClientStopResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ServersClientStopResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Stop - Stops a running server. @@ -538,22 +527,16 @@ func (client *ServersClient) stopCreateRequest(ctx context.Context, resourceGrou // serverName - The name of the server. // parameters - The required parameters for updating a server. // options - ServersClientBeginUpdateOptions contains the optional parameters for the ServersClient.BeginUpdate method. -func (client *ServersClient) BeginUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdateParameters, options *ServersClientBeginUpdateOptions) (ServersClientUpdatePollerResponse, error) { - resp, err := client.update(ctx, resourceGroupName, serverName, parameters, options) - if err != nil { - return ServersClientUpdatePollerResponse{}, err +func (client *ServersClient) BeginUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdateParameters, options *ServersClientBeginUpdateOptions) (*armruntime.Poller[ServersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, serverName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ServersClientUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ServersClientUpdateResponse](options.ResumeToken, client.pl, nil) } - result := ServersClientUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("ServersClient.Update", "", resp, client.pl) - if err != nil { - return ServersClientUpdatePollerResponse{}, err - } - result.Poller = &ServersClientUpdatePoller{ - pt: pt, - } - return result, nil } // Update - Updates an existing server. The request body can contain one to many of the properties present in the normal server diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_serversecurityalertpolicies_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_serversecurityalertpolicies_client.go index dab065a9417c..09ef4e6c9eb8 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_serversecurityalertpolicies_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_serversecurityalertpolicies_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ServerSecurityAlertPoliciesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewServerSecurityAlertPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerSecurityAlertPoliciesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewServerSecurityAlertPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerSecurityAlertPoliciesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ServerSecurityAlertPoliciesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Creates or updates a threat detection policy. @@ -57,22 +62,16 @@ func NewServerSecurityAlertPoliciesClient(subscriptionID string, credential azco // parameters - The server security alert policy. // options - ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.BeginCreateOrUpdate // method. -func (client *ServerSecurityAlertPoliciesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyName, parameters ServerSecurityAlertPolicy, options *ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (ServerSecurityAlertPoliciesClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, securityAlertPolicyName, parameters, options) - if err != nil { - return ServerSecurityAlertPoliciesClientCreateOrUpdatePollerResponse{}, err - } - result := ServerSecurityAlertPoliciesClientCreateOrUpdatePollerResponse{ - RawResponse: resp, +func (client *ServerSecurityAlertPoliciesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyName, parameters ServerSecurityAlertPolicy, options *ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*armruntime.Poller[ServerSecurityAlertPoliciesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, securityAlertPolicyName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ServerSecurityAlertPoliciesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ServerSecurityAlertPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("ServerSecurityAlertPoliciesClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return ServerSecurityAlertPoliciesClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &ServerSecurityAlertPoliciesClientCreateOrUpdatePoller{ - pt: pt, - } - return result, nil } // CreateOrUpdate - Creates or updates a threat detection policy. @@ -176,7 +175,7 @@ func (client *ServerSecurityAlertPoliciesClient) getCreateRequest(ctx context.Co // getHandleResponse handles the Get response. func (client *ServerSecurityAlertPoliciesClient) getHandleResponse(resp *http.Response) (ServerSecurityAlertPoliciesClientGetResponse, error) { - result := ServerSecurityAlertPoliciesClientGetResponse{RawResponse: resp} + result := ServerSecurityAlertPoliciesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ServerSecurityAlertPolicy); err != nil { return ServerSecurityAlertPoliciesClientGetResponse{}, err } @@ -189,16 +188,32 @@ func (client *ServerSecurityAlertPoliciesClient) getHandleResponse(resp *http.Re // serverName - The name of the server. // options - ServerSecurityAlertPoliciesClientListByServerOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.ListByServer // method. -func (client *ServerSecurityAlertPoliciesClient) ListByServer(resourceGroupName string, serverName string, options *ServerSecurityAlertPoliciesClientListByServerOptions) *ServerSecurityAlertPoliciesClientListByServerPager { - return &ServerSecurityAlertPoliciesClientListByServerPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) +func (client *ServerSecurityAlertPoliciesClient) ListByServer(resourceGroupName string, serverName string, options *ServerSecurityAlertPoliciesClientListByServerOptions) *runtime.Pager[ServerSecurityAlertPoliciesClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[ServerSecurityAlertPoliciesClientListByServerResponse]{ + More: func(page ServerSecurityAlertPoliciesClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ServerSecurityAlertPoliciesClientListByServerResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ServerSecurityAlertPolicyListResult.NextLink) + Fetcher: func(ctx context.Context, page *ServerSecurityAlertPoliciesClientListByServerResponse) (ServerSecurityAlertPoliciesClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ServerSecurityAlertPoliciesClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServerSecurityAlertPoliciesClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServerSecurityAlertPoliciesClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) }, - } + }) } // listByServerCreateRequest creates the ListByServer request. @@ -229,7 +244,7 @@ func (client *ServerSecurityAlertPoliciesClient) listByServerCreateRequest(ctx c // listByServerHandleResponse handles the ListByServer response. func (client *ServerSecurityAlertPoliciesClient) listByServerHandleResponse(resp *http.Response) (ServerSecurityAlertPoliciesClientListByServerResponse, error) { - result := ServerSecurityAlertPoliciesClientListByServerResponse{RawResponse: resp} + result := ServerSecurityAlertPoliciesClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ServerSecurityAlertPolicyListResult); err != nil { return ServerSecurityAlertPoliciesClientListByServerResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_time_rfc3339.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_time_rfc3339.go index 0d6d0deeed94..06188affbe25 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_topquerystatistics_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_topquerystatistics_client.go index 86956568e9de..120b85bbb043 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_topquerystatistics_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_topquerystatistics_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type TopQueryStatisticsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewTopQueryStatisticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TopQueryStatisticsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewTopQueryStatisticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TopQueryStatisticsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &TopQueryStatisticsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Retrieve the query statistic for specified identifier. @@ -102,7 +107,7 @@ func (client *TopQueryStatisticsClient) getCreateRequest(ctx context.Context, re // getHandleResponse handles the Get response. func (client *TopQueryStatisticsClient) getHandleResponse(resp *http.Response) (TopQueryStatisticsClientGetResponse, error) { - result := TopQueryStatisticsClientGetResponse{RawResponse: resp} + result := TopQueryStatisticsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.QueryStatistic); err != nil { return TopQueryStatisticsClientGetResponse{}, err } @@ -116,16 +121,32 @@ func (client *TopQueryStatisticsClient) getHandleResponse(resp *http.Response) ( // parameters - The required parameters for retrieving top query statistics. // options - TopQueryStatisticsClientListByServerOptions contains the optional parameters for the TopQueryStatisticsClient.ListByServer // method. -func (client *TopQueryStatisticsClient) ListByServer(resourceGroupName string, serverName string, parameters TopQueryStatisticsInput, options *TopQueryStatisticsClientListByServerOptions) *TopQueryStatisticsClientListByServerPager { - return &TopQueryStatisticsClientListByServerPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByServerCreateRequest(ctx, resourceGroupName, serverName, parameters, options) +func (client *TopQueryStatisticsClient) ListByServer(resourceGroupName string, serverName string, parameters TopQueryStatisticsInput, options *TopQueryStatisticsClientListByServerOptions) *runtime.Pager[TopQueryStatisticsClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[TopQueryStatisticsClientListByServerResponse]{ + More: func(page TopQueryStatisticsClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp TopQueryStatisticsClientListByServerResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.TopQueryStatisticsResultList.NextLink) + Fetcher: func(ctx context.Context, page *TopQueryStatisticsClientListByServerResponse) (TopQueryStatisticsClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, parameters, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return TopQueryStatisticsClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TopQueryStatisticsClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TopQueryStatisticsClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) }, - } + }) } // listByServerCreateRequest creates the ListByServer request. @@ -156,7 +177,7 @@ func (client *TopQueryStatisticsClient) listByServerCreateRequest(ctx context.Co // listByServerHandleResponse handles the ListByServer response. func (client *TopQueryStatisticsClient) listByServerHandleResponse(resp *http.Response) (TopQueryStatisticsClientListByServerResponse, error) { - result := TopQueryStatisticsClientListByServerResponse{RawResponse: resp} + result := TopQueryStatisticsClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.TopQueryStatisticsResultList); err != nil { return TopQueryStatisticsClientListByServerResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_virtualnetworkrules_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_virtualnetworkrules_client.go index 2294f480f9e3..6bc8633f7df1 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_virtualnetworkrules_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_virtualnetworkrules_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type VirtualNetworkRulesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewVirtualNetworkRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworkRulesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewVirtualNetworkRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworkRulesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &VirtualNetworkRulesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Creates or updates an existing virtual network rule. @@ -57,22 +62,16 @@ func NewVirtualNetworkRulesClient(subscriptionID string, credential azcore.Token // parameters - The requested virtual Network Rule Resource state. // options - VirtualNetworkRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkRulesClient.BeginCreateOrUpdate // method. -func (client *VirtualNetworkRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule, options *VirtualNetworkRulesClientBeginCreateOrUpdateOptions) (VirtualNetworkRulesClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, virtualNetworkRuleName, parameters, options) - if err != nil { - return VirtualNetworkRulesClientCreateOrUpdatePollerResponse{}, err - } - result := VirtualNetworkRulesClientCreateOrUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("VirtualNetworkRulesClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return VirtualNetworkRulesClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &VirtualNetworkRulesClientCreateOrUpdatePoller{ - pt: pt, +func (client *VirtualNetworkRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule, options *VirtualNetworkRulesClientBeginCreateOrUpdateOptions) (*armruntime.Poller[VirtualNetworkRulesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, virtualNetworkRuleName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[VirtualNetworkRulesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[VirtualNetworkRulesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // CreateOrUpdate - Creates or updates an existing virtual network rule. @@ -129,22 +128,16 @@ func (client *VirtualNetworkRulesClient) createOrUpdateCreateRequest(ctx context // virtualNetworkRuleName - The name of the virtual network rule. // options - VirtualNetworkRulesClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkRulesClient.BeginDelete // method. -func (client *VirtualNetworkRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, options *VirtualNetworkRulesClientBeginDeleteOptions) (VirtualNetworkRulesClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, virtualNetworkRuleName, options) - if err != nil { - return VirtualNetworkRulesClientDeletePollerResponse{}, err - } - result := VirtualNetworkRulesClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("VirtualNetworkRulesClient.Delete", "", resp, client.pl) - if err != nil { - return VirtualNetworkRulesClientDeletePollerResponse{}, err - } - result.Poller = &VirtualNetworkRulesClientDeletePoller{ - pt: pt, +func (client *VirtualNetworkRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, options *VirtualNetworkRulesClientBeginDeleteOptions) (*armruntime.Poller[VirtualNetworkRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, virtualNetworkRuleName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[VirtualNetworkRulesClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[VirtualNetworkRulesClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - Deletes the virtual network rule with the given name. @@ -246,7 +239,7 @@ func (client *VirtualNetworkRulesClient) getCreateRequest(ctx context.Context, r // getHandleResponse handles the Get response. func (client *VirtualNetworkRulesClient) getHandleResponse(resp *http.Response) (VirtualNetworkRulesClientGetResponse, error) { - result := VirtualNetworkRulesClientGetResponse{RawResponse: resp} + result := VirtualNetworkRulesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkRule); err != nil { return VirtualNetworkRulesClientGetResponse{}, err } @@ -259,16 +252,32 @@ func (client *VirtualNetworkRulesClient) getHandleResponse(resp *http.Response) // serverName - The name of the server. // options - VirtualNetworkRulesClientListByServerOptions contains the optional parameters for the VirtualNetworkRulesClient.ListByServer // method. -func (client *VirtualNetworkRulesClient) ListByServer(resourceGroupName string, serverName string, options *VirtualNetworkRulesClientListByServerOptions) *VirtualNetworkRulesClientListByServerPager { - return &VirtualNetworkRulesClientListByServerPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) +func (client *VirtualNetworkRulesClient) ListByServer(resourceGroupName string, serverName string, options *VirtualNetworkRulesClientListByServerOptions) *runtime.Pager[VirtualNetworkRulesClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[VirtualNetworkRulesClientListByServerResponse]{ + More: func(page VirtualNetworkRulesClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp VirtualNetworkRulesClientListByServerResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualNetworkRuleListResult.NextLink) + Fetcher: func(ctx context.Context, page *VirtualNetworkRulesClientListByServerResponse) (VirtualNetworkRulesClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualNetworkRulesClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkRulesClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkRulesClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) }, - } + }) } // listByServerCreateRequest creates the ListByServer request. @@ -299,7 +308,7 @@ func (client *VirtualNetworkRulesClient) listByServerCreateRequest(ctx context.C // listByServerHandleResponse handles the ListByServer response. func (client *VirtualNetworkRulesClient) listByServerHandleResponse(resp *http.Response) (VirtualNetworkRulesClientListByServerResponse, error) { - result := VirtualNetworkRulesClientListByServerResponse{RawResponse: resp} + result := VirtualNetworkRulesClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkRuleListResult); err != nil { return VirtualNetworkRulesClientListByServerResponse{}, err } diff --git a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_waitstatistics_client.go b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_waitstatistics_client.go index b293d5e91800..ea8775eaa813 100644 --- a/sdk/resourcemanager/mariadb/armmariadb/zz_generated_waitstatistics_client.go +++ b/sdk/resourcemanager/mariadb/armmariadb/zz_generated_waitstatistics_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type WaitStatisticsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewWaitStatisticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WaitStatisticsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewWaitStatisticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WaitStatisticsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &WaitStatisticsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Retrieve wait statistics for specified identifier. @@ -102,7 +107,7 @@ func (client *WaitStatisticsClient) getCreateRequest(ctx context.Context, resour // getHandleResponse handles the Get response. func (client *WaitStatisticsClient) getHandleResponse(resp *http.Response) (WaitStatisticsClientGetResponse, error) { - result := WaitStatisticsClientGetResponse{RawResponse: resp} + result := WaitStatisticsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.WaitStatistic); err != nil { return WaitStatisticsClientGetResponse{}, err } @@ -116,16 +121,32 @@ func (client *WaitStatisticsClient) getHandleResponse(resp *http.Response) (Wait // parameters - The required parameters for retrieving wait statistics. // options - WaitStatisticsClientListByServerOptions contains the optional parameters for the WaitStatisticsClient.ListByServer // method. -func (client *WaitStatisticsClient) ListByServer(resourceGroupName string, serverName string, parameters WaitStatisticsInput, options *WaitStatisticsClientListByServerOptions) *WaitStatisticsClientListByServerPager { - return &WaitStatisticsClientListByServerPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByServerCreateRequest(ctx, resourceGroupName, serverName, parameters, options) +func (client *WaitStatisticsClient) ListByServer(resourceGroupName string, serverName string, parameters WaitStatisticsInput, options *WaitStatisticsClientListByServerOptions) *runtime.Pager[WaitStatisticsClientListByServerResponse] { + return runtime.NewPager(runtime.PageProcessor[WaitStatisticsClientListByServerResponse]{ + More: func(page WaitStatisticsClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp WaitStatisticsClientListByServerResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.WaitStatisticsResultList.NextLink) + Fetcher: func(ctx context.Context, page *WaitStatisticsClientListByServerResponse) (WaitStatisticsClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, parameters, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WaitStatisticsClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WaitStatisticsClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WaitStatisticsClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) }, - } + }) } // listByServerCreateRequest creates the ListByServer request. @@ -156,7 +177,7 @@ func (client *WaitStatisticsClient) listByServerCreateRequest(ctx context.Contex // listByServerHandleResponse handles the ListByServer response. func (client *WaitStatisticsClient) listByServerHandleResponse(resp *http.Response) (WaitStatisticsClientListByServerResponse, error) { - result := WaitStatisticsClientListByServerResponse{RawResponse: resp} + result := WaitStatisticsClientListByServerResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.WaitStatisticsResultList); err != nil { return WaitStatisticsClientListByServerResponse{}, err } diff --git a/sdk/resourcemanager/marketplace/armmarketplace/CHANGELOG.md b/sdk/resourcemanager/marketplace/armmarketplace/CHANGELOG.md index ad2b0f58f127..95b680d3c4c8 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/CHANGELOG.md +++ b/sdk/resourcemanager/marketplace/armmarketplace/CHANGELOG.md @@ -1,5 +1,165 @@ # Release History +## 0.3.0 (2022-04-12) +### Breaking Changes + +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `*PrivateStoreCollectionOfferClient.List` return value(s) have been changed from `(*PrivateStoreCollectionOfferClientListPager)` to `(*runtime.Pager[PrivateStoreCollectionOfferClientListResponse])` +- Function `*PrivateStoreClient.List` return value(s) have been changed from `(*PrivateStoreClientListPager)` to `(*runtime.Pager[PrivateStoreClientListResponse])` +- Function `NewPrivateStoreCollectionOfferClient` return value(s) have been changed from `(*PrivateStoreCollectionOfferClient)` to `(*PrivateStoreCollectionOfferClient, error)` +- Function `NewPrivateStoreClient` return value(s) have been changed from `(*PrivateStoreClient)` to `(*PrivateStoreClient, error)` +- Function `NewPrivateStoreCollectionClient` return value(s) have been changed from `(*PrivateStoreCollectionClient)` to `(*PrivateStoreCollectionClient, error)` +- Type of `SingleOperation.Properties` has been changed from `map[string]interface{}` to `interface{}` +- Function `Accessibility.ToPtr` has been removed +- Function `Availability.ToPtr` has been removed +- Function `Operation.ToPtr` has been removed +- Function `*PrivateStoreCollectionOfferClientListPager.PageResponse` has been removed +- Function `*PrivateStoreCollectionOfferClientListPager.Err` has been removed +- Function `*PrivateStoreClientListPager.Err` has been removed +- Function `*PrivateStoreClientListPager.NextPage` has been removed +- Function `AdminAction.ToPtr` has been removed +- Function `IdentityType.ToPtr` has been removed +- Function `*PrivateStoreCollectionOfferClientListPager.NextPage` has been removed +- Function `*PrivateStoreClientListPager.PageResponse` has been removed +- Function `Status.ToPtr` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `PrivateStoreClientAdminRequestApprovalsListResult` has been removed +- Struct `PrivateStoreClientBillingAccountsResult` has been removed +- Struct `PrivateStoreClientBulkCollectionsActionResult` has been removed +- Struct `PrivateStoreClientCollectionsToSubscriptionsMappingResult` has been removed +- Struct `PrivateStoreClientCreateApprovalRequestResult` has been removed +- Struct `PrivateStoreClientGetAdminRequestApprovalResult` has been removed +- Struct `PrivateStoreClientGetApprovalRequestsListResult` has been removed +- Struct `PrivateStoreClientGetRequestApprovalResult` has been removed +- Struct `PrivateStoreClientGetResult` has been removed +- Struct `PrivateStoreClientListPager` has been removed +- Struct `PrivateStoreClientListResult` has been removed +- Struct `PrivateStoreClientQueryApprovedPlansResult` has been removed +- Struct `PrivateStoreClientQueryNotificationsStateResult` has been removed +- Struct `PrivateStoreClientQueryOffersResult` has been removed +- Struct `PrivateStoreClientQueryRequestApprovalResult` has been removed +- Struct `PrivateStoreClientUpdateAdminRequestApprovalResult` has been removed +- Struct `PrivateStoreCollectionClientCreateOrUpdateResult` has been removed +- Struct `PrivateStoreCollectionClientGetResult` has been removed +- Struct `PrivateStoreCollectionClientListResult` has been removed +- Struct `PrivateStoreCollectionClientTransferOffersResult` has been removed +- Struct `PrivateStoreCollectionOfferClientCreateOrUpdateResult` has been removed +- Struct `PrivateStoreCollectionOfferClientGetResult` has been removed +- Struct `PrivateStoreCollectionOfferClientListPager` has been removed +- Struct `PrivateStoreCollectionOfferClientListResult` has been removed +- Field `PrivateStoreClientUpdateAdminRequestApprovalResult` of struct `PrivateStoreClientUpdateAdminRequestApprovalResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientUpdateAdminRequestApprovalResponse` has been removed +- Field `PrivateStoreClientGetRequestApprovalResult` of struct `PrivateStoreClientGetRequestApprovalResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientGetRequestApprovalResponse` has been removed +- Field `PrivateStoreClientQueryOffersResult` of struct `PrivateStoreClientQueryOffersResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientQueryOffersResponse` has been removed +- Field `PrivateStoreClientBillingAccountsResult` of struct `PrivateStoreClientBillingAccountsResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientBillingAccountsResponse` has been removed +- Field `PrivateStoreCollectionOfferClientGetResult` of struct `PrivateStoreCollectionOfferClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreCollectionOfferClientGetResponse` has been removed +- Field `PrivateStoreCollectionClientTransferOffersResult` of struct `PrivateStoreCollectionClientTransferOffersResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreCollectionClientTransferOffersResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientAcknowledgeOfferNotificationResponse` has been removed +- Field `PrivateStoreClientCreateApprovalRequestResult` of struct `PrivateStoreClientCreateApprovalRequestResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientCreateApprovalRequestResponse` has been removed +- Field `PrivateStoreClientGetApprovalRequestsListResult` of struct `PrivateStoreClientGetApprovalRequestsListResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientGetApprovalRequestsListResponse` has been removed +- Field `PrivateStoreClientGetAdminRequestApprovalResult` of struct `PrivateStoreClientGetAdminRequestApprovalResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientGetAdminRequestApprovalResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreCollectionClientPostResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreCollectionOfferClientDeleteResponse` has been removed +- Field `PrivateStoreCollectionClientGetResult` of struct `PrivateStoreCollectionClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreCollectionClientGetResponse` has been removed +- Field `PrivateStoreCollectionOfferClientListResult` of struct `PrivateStoreCollectionOfferClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreCollectionOfferClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreCollectionOfferClientPostResponse` has been removed +- Field `PrivateStoreClientCollectionsToSubscriptionsMappingResult` of struct `PrivateStoreClientCollectionsToSubscriptionsMappingResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientCollectionsToSubscriptionsMappingResponse` has been removed +- Field `PrivateStoreCollectionClientListResult` of struct `PrivateStoreCollectionClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreCollectionClientListResponse` has been removed +- Field `PrivateStoreClientListResult` of struct `PrivateStoreClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientListResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientWithdrawPlanResponse` has been removed +- Field `PrivateStoreCollectionOfferClientCreateOrUpdateResult` of struct `PrivateStoreCollectionOfferClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreCollectionOfferClientCreateOrUpdateResponse` has been removed +- Field `PrivateStoreClientQueryNotificationsStateResult` of struct `PrivateStoreClientQueryNotificationsStateResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientQueryNotificationsStateResponse` has been removed +- Field `PrivateStoreCollectionClientCreateOrUpdateResult` of struct `PrivateStoreCollectionClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreCollectionClientCreateOrUpdateResponse` has been removed +- Field `PrivateStoreClientQueryRequestApprovalResult` of struct `PrivateStoreClientQueryRequestApprovalResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientQueryRequestApprovalResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientDeleteResponse` has been removed +- Field `PrivateStoreClientBulkCollectionsActionResult` of struct `PrivateStoreClientBulkCollectionsActionResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientBulkCollectionsActionResponse` has been removed +- Field `PrivateStoreClientGetResult` of struct `PrivateStoreClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientGetResponse` has been removed +- Field `PrivateStoreClientQueryApprovedPlansResult` of struct `PrivateStoreClientQueryApprovedPlansResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientQueryApprovedPlansResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreCollectionClientDeleteResponse` has been removed +- Field `PrivateStoreClientAdminRequestApprovalsListResult` of struct `PrivateStoreClientAdminRequestApprovalsListResponse` has been removed +- Field `RawResponse` of struct `PrivateStoreClientAdminRequestApprovalsListResponse` has been removed + +### Features Added + +- New const `SubscriptionStateWarned` +- New const `SubscriptionStateDisabled` +- New const `SubscriptionStatePastDue` +- New const `SubscriptionStateDeleted` +- New const `SubscriptionStateEnabled` +- New function `*PrivateStoreClient.FetchAllSubscriptionsInTenant(context.Context, string, *PrivateStoreClientFetchAllSubscriptionsInTenantOptions) (PrivateStoreClientFetchAllSubscriptionsInTenantResponse, error)` +- New function `*PrivateStoreClient.ListSubscriptionsContext(context.Context, string, *PrivateStoreClientListSubscriptionsContextOptions) (PrivateStoreClientListSubscriptionsContextResponse, error)` +- New function `*PrivateStoreClient.ListStopSellOffersPlansNotifications(context.Context, string, *PrivateStoreClientListStopSellOffersPlansNotificationsOptions) (PrivateStoreClientListStopSellOffersPlansNotificationsResponse, error)` +- New function `*PrivateStoreClient.ListNewPlansNotifications(context.Context, string, *PrivateStoreClientListNewPlansNotificationsOptions) (PrivateStoreClientListNewPlansNotificationsResponse, error)` +- New function `StopSellOffersPlansNotificationsList.MarshalJSON() ([]byte, error)` +- New function `StopSellOffersPlansNotificationsListProperties.MarshalJSON() ([]byte, error)` +- New function `SubscriptionsResponse.MarshalJSON() ([]byte, error)` +- New function `SubscriptionsContextList.MarshalJSON() ([]byte, error)` +- New function `StopSellSubscriptions.MarshalJSON() ([]byte, error)` +- New function `NewPlansNotificationsList.MarshalJSON() ([]byte, error)` +- New function `PossibleSubscriptionStateValues() []SubscriptionState` +- New struct `NewPlansNotificationsList` +- New struct `PrivateStoreClientFetchAllSubscriptionsInTenantOptions` +- New struct `PrivateStoreClientFetchAllSubscriptionsInTenantResponse` +- New struct `PrivateStoreClientListNewPlansNotificationsOptions` +- New struct `PrivateStoreClientListNewPlansNotificationsResponse` +- New struct `PrivateStoreClientListStopSellOffersPlansNotificationsOptions` +- New struct `PrivateStoreClientListStopSellOffersPlansNotificationsResponse` +- New struct `PrivateStoreClientListSubscriptionsContextOptions` +- New struct `PrivateStoreClientListSubscriptionsContextResponse` +- New struct `StopSellOffersPlansNotificationsList` +- New struct `StopSellOffersPlansNotificationsListProperties` +- New struct `StopSellSubscriptions` +- New struct `Subscription` +- New struct `SubscriptionsContextList` +- New struct `SubscriptionsResponse` +- New anonymous field `TransferOffersResponse` in struct `PrivateStoreCollectionClientTransferOffersResponse` +- New anonymous field `CollectionsList` in struct `PrivateStoreCollectionClientListResponse` +- New anonymous field `Collection` in struct `PrivateStoreCollectionClientGetResponse` +- New anonymous field `BulkCollectionsResponse` in struct `PrivateStoreClientBulkCollectionsActionResponse` +- New anonymous field `OfferListResponse` in struct `PrivateStoreCollectionOfferClientListResponse` +- New anonymous field `PrivateStoreList` in struct `PrivateStoreClientListResponse` +- New anonymous field `AdminRequestApprovalsResource` in struct `PrivateStoreClientUpdateAdminRequestApprovalResponse` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New anonymous field `Offer` in struct `PrivateStoreCollectionOfferClientCreateOrUpdateResponse` +- New anonymous field `AdminRequestApprovalsList` in struct `PrivateStoreClientAdminRequestApprovalsListResponse` +- New anonymous field `PrivateStore` in struct `PrivateStoreClientGetResponse` +- New anonymous field `Offer` in struct `PrivateStoreCollectionOfferClientGetResponse` +- New anonymous field `RequestApprovalsList` in struct `PrivateStoreClientGetApprovalRequestsListResponse` +- New anonymous field `AdminRequestApprovalsResource` in struct `PrivateStoreClientGetAdminRequestApprovalResponse` +- New anonymous field `RequestApprovalResource` in struct `PrivateStoreClientCreateApprovalRequestResponse` +- New anonymous field `Collection` in struct `PrivateStoreCollectionClientCreateOrUpdateResponse` +- New anonymous field `QueryRequestApproval` in struct `PrivateStoreClientQueryRequestApprovalResponse` +- New anonymous field `QueryApprovedPlansResponse` in struct `PrivateStoreClientQueryApprovedPlansResponse` +- New anonymous field `BillingAccountsResponse` in struct `PrivateStoreClientBillingAccountsResponse` +- New anonymous field `CollectionsToSubscriptionsMappingResponse` in struct `PrivateStoreClientCollectionsToSubscriptionsMappingResponse` +- New anonymous field `PrivateStoreNotificationsState` in struct `PrivateStoreClientQueryNotificationsStateResponse` +- New anonymous field `QueryOffers` in struct `PrivateStoreClientQueryOffersResponse` +- New anonymous field `RequestApprovalResource` in struct `PrivateStoreClientGetRequestApprovalResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/marketplace/armmarketplace/README.md b/sdk/resourcemanager/marketplace/armmarketplace/README.md index e1b4e314a70e..d174fd262a48 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/README.md +++ b/sdk/resourcemanager/marketplace/armmarketplace/README.md @@ -11,7 +11,7 @@ The `armmarketplace` module provides operations for working with Azure Marketpla ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Marketplace 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 -client := armmarketplace.(, cred, nil) +client, err := armmarketplace.(, cred, nil) ``` 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 -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armmarketplace.(, cred, &options) +client, err := armmarketplace.(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/marketplace/armmarketplace/autorest.md b/sdk/resourcemanager/marketplace/armmarketplace/autorest.md index 8994b5f23dd0..7db89dfa4614 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/autorest.md +++ b/sdk/resourcemanager/marketplace/armmarketplace/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/marketplace/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/marketplace/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/marketplace/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/marketplace/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/marketplace/armmarketplace/go.mod b/sdk/resourcemanager/marketplace/armmarketplace/go.mod index dc1ba073744c..f9d900024508 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/go.mod +++ b/sdk/resourcemanager/marketplace/armmarketplace/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/marketplace/armmarketplace -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/marketplace/armmarketplace/go.sum b/sdk/resourcemanager/marketplace/armmarketplace/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/go.sum +++ b/sdk/resourcemanager/marketplace/armmarketplace/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm 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/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/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-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_operations_client_test.go new file mode 100644 index 000000000000..ad7687dcd37e --- /dev/null +++ b/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_operations_client_test.go @@ -0,0 +1,40 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmarketplace_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/marketplace/armmarketplace" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/GetOperations.json +func ExampleOperationsClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + return + } + ctx := context.Background() + client, err := armmarketplace.NewOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + res, err := client.List(ctx, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + return + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_privatestore_client_test.go b/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_privatestore_client_test.go index 5f105b730218..2c72f37ae273 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_privatestore_client_test.go +++ b/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_privatestore_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,401 +17,623 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/marketplace/armmarketplace" ) -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/GetPrivateStores.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/GetPrivateStores.json func ExamplePrivateStoreClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(&armmarketplace.PrivateStoreClientListOptions{UseCache: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/GetPrivateStore.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/GetPrivateStore.json func ExamplePrivateStoreClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/PrivateStores_update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/PrivateStores_update.json func ExamplePrivateStoreClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.CreateOrUpdate(ctx, "", &armmarketplace.PrivateStoreClientCreateOrUpdateOptions{Payload: &armmarketplace.PrivateStore{ Properties: &armmarketplace.PrivateStoreProperties{ - Availability: armmarketplace.Availability("disabled").ToPtr(), - ETag: to.StringPtr(""), + Availability: to.Ptr(armmarketplace.AvailabilityDisabled), + ETag: to.Ptr(""), }, }, }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/DeletePrivateStore.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/DeletePrivateStore.json func ExamplePrivateStoreClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/QueryOffers.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/QueryOffers.json func ExamplePrivateStoreClient_QueryOffers() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.QueryOffers(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientQueryOffersResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/BillingAccounts.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/BillingAccounts.json func ExamplePrivateStoreClient_BillingAccounts() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.BillingAccounts(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientBillingAccountsResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/CollectionsToSubscriptionsMapping.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/CollectionsToSubscriptionsMapping.json func ExamplePrivateStoreClient_CollectionsToSubscriptionsMapping() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CollectionsToSubscriptionsMapping(ctx, "", &armmarketplace.PrivateStoreClientCollectionsToSubscriptionsMappingOptions{Payload: &armmarketplace.CollectionsToSubscriptionsMappingPayload{ Properties: &armmarketplace.CollectionsToSubscriptionsMappingProperties{ SubscriptionIDs: []*string{ - to.StringPtr("b340914e-353d-453a-85fb-8f9b65b51f91"), - to.StringPtr("f2baa04d-5bfc-461b-b6d8-61b403c9ec48")}, + to.Ptr("b340914e-353d-453a-85fb-8f9b65b51f91"), + to.Ptr("f2baa04d-5bfc-461b-b6d8-61b403c9ec48")}, }, }, }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientCollectionsToSubscriptionsMappingResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/QueryApprovedPlans.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/QueryApprovedPlans.json func ExamplePrivateStoreClient_QueryApprovedPlans() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.QueryApprovedPlans(ctx, "", &armmarketplace.PrivateStoreClientQueryApprovedPlansOptions{Payload: &armmarketplace.QueryApprovedPlansPayload{ Properties: &armmarketplace.QueryApprovedPlans{ - OfferID: to.StringPtr(""), + OfferID: to.Ptr(""), PlanIDs: []*string{ - to.StringPtr("testPlanA"), - to.StringPtr("testPlanB"), - to.StringPtr("testPlanC")}, + to.Ptr("testPlanA"), + to.Ptr("testPlanB"), + to.Ptr("testPlanC")}, }, }, }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientQueryApprovedPlansResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/BulkCollectionsAction.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/BulkCollectionsAction.json func ExamplePrivateStoreClient_BulkCollectionsAction() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.BulkCollectionsAction(ctx, "", &armmarketplace.PrivateStoreClientBulkCollectionsActionOptions{Payload: &armmarketplace.BulkCollectionsPayload{ Properties: &armmarketplace.BulkCollectionsDetails{ - Action: to.StringPtr(""), + Action: to.Ptr(""), CollectionIDs: []*string{ - to.StringPtr("c752f021-1c37-4af5-b82f-74c51c27b44a"), - to.StringPtr("f47ef1c7-e908-4f39-ae29-db181634ad8d")}, + to.Ptr("c752f021-1c37-4af5-b82f-74c51c27b44a"), + to.Ptr("f47ef1c7-e908-4f39-ae29-db181634ad8d")}, }, }, }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientBulkCollectionsActionResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/GetApprovalRequestsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/GetApprovalRequestsList.json func ExamplePrivateStoreClient_GetApprovalRequestsList() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.GetApprovalRequestsList(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientGetApprovalRequestsListResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/GetRequestApproval.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/GetRequestApproval.json func ExamplePrivateStoreClient_GetRequestApproval() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.GetRequestApproval(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientGetRequestApprovalResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/CreateApprovalRequest.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/CreateApprovalRequest.json func ExamplePrivateStoreClient_CreateApprovalRequest() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateApprovalRequest(ctx, "", "", &armmarketplace.PrivateStoreClientCreateApprovalRequestOptions{Payload: nil}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientCreateApprovalRequestResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/QueryRequestApproval.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/QueryRequestApproval.json func ExamplePrivateStoreClient_QueryRequestApproval() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.QueryRequestApproval(ctx, "", "", &armmarketplace.PrivateStoreClientQueryRequestApprovalOptions{Payload: &armmarketplace.QueryRequestApprovalProperties{ Properties: &armmarketplace.RequestDetails{ PlanIDs: []*string{ - to.StringPtr("testPlanA"), - to.StringPtr("testPlanB"), - to.StringPtr("*")}, - PublisherID: to.StringPtr(""), + to.Ptr("testPlanA"), + to.Ptr("testPlanB"), + to.Ptr("*")}, + PublisherID: to.Ptr(""), }, }, }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientQueryRequestApprovalResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/AdminRequestApprovalsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/AdminRequestApprovalsList.json func ExamplePrivateStoreClient_AdminRequestApprovalsList() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.AdminRequestApprovalsList(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientAdminRequestApprovalsListResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/GetAdminRequestApproval.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/GetAdminRequestApproval.json func ExamplePrivateStoreClient_GetAdminRequestApproval() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.GetAdminRequestApproval(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientGetAdminRequestApprovalResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/UpdateAdminRequestApproval.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/UpdateAdminRequestApproval.json func ExamplePrivateStoreClient_UpdateAdminRequestApproval() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.UpdateAdminRequestApproval(ctx, "", "", &armmarketplace.PrivateStoreClientUpdateAdminRequestApprovalOptions{Payload: &armmarketplace.AdminRequestApprovalsResource{ Properties: &armmarketplace.AdminRequestApprovalProperties{ - AdminAction: armmarketplace.AdminAction("Approved").ToPtr(), + AdminAction: to.Ptr(armmarketplace.AdminActionApproved), ApprovedPlans: []*string{ - to.StringPtr("testPlan")}, + to.Ptr("testPlan")}, CollectionIDs: []*string{ - to.StringPtr("f8ee227e-85d7-477d-abbf-854d6decaf70"), - to.StringPtr("39246ad6-c521-4fed-8de7-77dede2e873f")}, - Comment: to.StringPtr(""), - PublisherID: to.StringPtr(""), + to.Ptr("f8ee227e-85d7-477d-abbf-854d6decaf70"), + to.Ptr("39246ad6-c521-4fed-8de7-77dede2e873f")}, + Comment: to.Ptr(""), + PublisherID: to.Ptr(""), }, }, }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientUpdateAdminRequestApprovalResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/NotificationsState.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/NotificationsState.json func ExamplePrivateStoreClient_QueryNotificationsState() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.QueryNotificationsState(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreClientQueryNotificationsStateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/AcknowledgeNotification.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/AcknowledgeNotification.json func ExamplePrivateStoreClient_AcknowledgeOfferNotification() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.AcknowledgeOfferNotification(ctx, "", "", &armmarketplace.PrivateStoreClientAcknowledgeOfferNotificationOptions{Payload: &armmarketplace.AcknowledgeOfferNotificationProperties{ Properties: &armmarketplace.AcknowledgeOfferNotificationDetails{ - Acknowledge: to.BoolPtr(false), - Dismiss: to.BoolPtr(false), - RemoveOffer: to.BoolPtr(false), + Acknowledge: to.Ptr(false), + Dismiss: to.Ptr(false), + RemoveOffer: to.Ptr(false), RemovePlans: []*string{ - to.StringPtr("testPlanA")}, + to.Ptr("testPlanA")}, }, }, }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/WithdrawPlan.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/WithdrawPlan.json func ExamplePrivateStoreClient_WithdrawPlan() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.WithdrawPlan(ctx, "", "", &armmarketplace.PrivateStoreClientWithdrawPlanOptions{Payload: &armmarketplace.WithdrawProperties{ Properties: &armmarketplace.WithdrawDetails{ - PlanID: to.StringPtr(""), - PublisherID: to.StringPtr(""), + PlanID: to.Ptr(""), + PublisherID: to.Ptr(""), }, }, }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/FetchAllSubscriptionsInTenant.json +func ExamplePrivateStoreClient_FetchAllSubscriptionsInTenant() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + return + } + ctx := context.Background() + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + res, err := client.FetchAllSubscriptionsInTenant(ctx, + "", + &armmarketplace.PrivateStoreClientFetchAllSubscriptionsInTenantOptions{NextPageToken: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + return + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/ListNewPlansNotifications.json +func ExamplePrivateStoreClient_ListNewPlansNotifications() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + return + } + ctx := context.Background() + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + res, err := client.ListNewPlansNotifications(ctx, + "", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + return + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/ListStopSellOffersPlansNotifications.json +func ExamplePrivateStoreClient_ListStopSellOffersPlansNotifications() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + return + } + ctx := context.Background() + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + res, err := client.ListStopSellOffersPlansNotifications(ctx, + "", + &armmarketplace.PrivateStoreClientListStopSellOffersPlansNotificationsOptions{StopSellSubscriptions: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + return + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/ListSubscriptionsContext.json +func ExamplePrivateStoreClient_ListSubscriptionsContext() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + return + } + ctx := context.Background() + client, err := armmarketplace.NewPrivateStoreClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + res, err := client.ListSubscriptionsContext(ctx, + "", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + return } + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_privatestorecollection_client_test.go b/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_privatestorecollection_client_test.go index c9a8f973411e..9272c74d6b03 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_privatestorecollection_client_test.go +++ b/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_privatestorecollection_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,128 +17,168 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/marketplace/armmarketplace" ) -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/GetPrivateStoreCollectionsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/GetPrivateStoreCollectionsList.json func ExamplePrivateStoreCollectionClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreCollectionClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreCollectionClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreCollectionClientListResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/GetPrivateStoreCollection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/GetPrivateStoreCollection.json func ExamplePrivateStoreCollectionClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreCollectionClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreCollectionClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreCollectionClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/CreatePrivateStoreCollection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/CreatePrivateStoreCollection.json func ExamplePrivateStoreCollectionClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreCollectionClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreCollectionClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", &armmarketplace.PrivateStoreCollectionClientCreateOrUpdateOptions{Payload: &armmarketplace.Collection{ Properties: &armmarketplace.CollectionProperties{ - AllSubscriptions: to.BoolPtr(false), - Claim: to.StringPtr(""), - CollectionName: to.StringPtr(""), + AllSubscriptions: to.Ptr(false), + Claim: to.Ptr(""), + CollectionName: to.Ptr(""), SubscriptionsList: []*string{ - to.StringPtr("b340914e-353d-453a-85fb-8f9b65b51f91"), - to.StringPtr("f2baa04d-5bfc-461b-b6d8-61b403c9ec48")}, + to.Ptr("b340914e-353d-453a-85fb-8f9b65b51f91"), + to.Ptr("f2baa04d-5bfc-461b-b6d8-61b403c9ec48")}, }, }, }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreCollectionClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/DeletePrivateStoreCollection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/DeletePrivateStoreCollection.json func ExamplePrivateStoreCollectionClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreCollectionClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreCollectionClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/PostPrivateStoreCollection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/PostPrivateStoreCollection.json func ExamplePrivateStoreCollectionClient_Post() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreCollectionClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreCollectionClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Post(ctx, "", "", &armmarketplace.PrivateStoreCollectionClientPostOptions{Payload: nil}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/TransferOffers.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/TransferOffers.json func ExamplePrivateStoreCollectionClient_TransferOffers() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreCollectionClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreCollectionClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.TransferOffers(ctx, "", "", &armmarketplace.PrivateStoreCollectionClientTransferOffersOptions{Payload: &armmarketplace.TransferOffersProperties{ Properties: &armmarketplace.TransferOffersDetails{ OfferIDsList: []*string{ - to.StringPtr("marketplacetestthirdparty.md-test-third-party-2"), - to.StringPtr("marketplacetestthirdparty.md-test-third-party-3")}, - Operation: to.StringPtr(""), + to.Ptr("marketplacetestthirdparty.md-test-third-party-2"), + to.Ptr("marketplacetestthirdparty.md-test-third-party-3")}, + Operation: to.Ptr(""), TargetCollections: []*string{ - to.StringPtr("c752f021-1c37-4af5-b82f-74c51c27b44a"), - to.StringPtr("f47ef1c7-e908-4f39-ae29-db181634ad8d")}, + to.Ptr("c752f021-1c37-4af5-b82f-74c51c27b44a"), + to.Ptr("f47ef1c7-e908-4f39-ae29-db181634ad8d")}, }, }, }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreCollectionClientTransferOffersResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_privatestorecollectionoffer_client_test.go b/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_privatestorecollectionoffer_client_test.go index 5849bdcb4488..53b7b324e1d4 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_privatestorecollectionoffer_client_test.go +++ b/sdk/resourcemanager/marketplace/armmarketplace/ze_generated_example_privatestorecollectionoffer_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,109 +17,139 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/marketplace/armmarketplace" ) -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/GetPrivateStoreOffers.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/GetPrivateStoreOffers.json func ExamplePrivateStoreCollectionOfferClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreCollectionOfferClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreCollectionOfferClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/GetPrivateStoreCollectionOffer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/GetPrivateStoreCollectionOffer.json func ExamplePrivateStoreCollectionOfferClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreCollectionOfferClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreCollectionOfferClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreCollectionOfferClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/PrivateStoreOffer_update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/PrivateStoreOffer_update.json func ExamplePrivateStoreCollectionOfferClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreCollectionOfferClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreCollectionOfferClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", "", &armmarketplace.PrivateStoreCollectionOfferClientCreateOrUpdateOptions{Payload: &armmarketplace.Offer{ Properties: &armmarketplace.OfferProperties{ - ETag: to.StringPtr(""), + ETag: to.Ptr(""), SpecificPlanIDsLimitation: []*string{ - to.StringPtr("0001"), - to.StringPtr("0002")}, + to.Ptr("0001"), + to.Ptr("0002")}, }, }, }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateStoreCollectionOfferClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/DeletePrivateStoreOffer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/DeletePrivateStoreOffer.json func ExamplePrivateStoreCollectionOfferClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreCollectionOfferClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreCollectionOfferClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/examples/PostPrivateStoreCollectionOffer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-12-01/examples/PostPrivateStoreCollectionOffer.json func ExamplePrivateStoreCollectionOfferClient_Post() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplace.NewPrivateStoreCollectionOfferClient(cred, nil) + client, err := armmarketplace.NewPrivateStoreCollectionOfferClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Post(ctx, "", "", "", &armmarketplace.PrivateStoreCollectionOfferClientPostOptions{Payload: nil}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } diff --git a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_constants.go b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_constants.go index ea7947333156..dec8d3bb0657 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_constants.go +++ b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armmarketplace const ( moduleName = "armmarketplace" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // Accessibility - Plan accessibility @@ -33,11 +33,6 @@ func PossibleAccessibilityValues() []Accessibility { } } -// ToPtr returns a *Accessibility pointing to the current value. -func (c Accessibility) ToPtr() *Accessibility { - return &c -} - // AdminAction - Gets or sets admin action type AdminAction string @@ -54,11 +49,6 @@ func PossibleAdminActionValues() []AdminAction { } } -// ToPtr returns a *AdminAction pointing to the current value. -func (c AdminAction) ToPtr() *AdminAction { - return &c -} - // Availability - Indicates private store availability type Availability string @@ -75,11 +65,6 @@ func PossibleAvailabilityValues() []Availability { } } -// ToPtr returns a *Availability pointing to the current value. -func (c Availability) ToPtr() *Availability { - return &c -} - // IdentityType - The type of identity that creates/modifies resources type IdentityType string @@ -100,11 +85,6 @@ func PossibleIdentityTypeValues() []IdentityType { } } -// ToPtr returns a *IdentityType pointing to the current value. -func (c IdentityType) ToPtr() *IdentityType { - return &c -} - // Operation - Set the Operation for the POST method. Ping or Delete type Operation string @@ -125,11 +105,6 @@ func PossibleOperationValues() []Operation { } } -// ToPtr returns a *Operation pointing to the current value. -func (c Operation) ToPtr() *Operation { - return &c -} - // Status - Gets the plan status type Status string @@ -150,7 +125,24 @@ func PossibleStatusValues() []Status { } } -// ToPtr returns a *Status pointing to the current value. -func (c Status) ToPtr() *Status { - return &c +// SubscriptionState - The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. +type SubscriptionState string + +const ( + SubscriptionStateDeleted SubscriptionState = "Deleted" + SubscriptionStateDisabled SubscriptionState = "Disabled" + SubscriptionStateEnabled SubscriptionState = "Enabled" + SubscriptionStatePastDue SubscriptionState = "PastDue" + SubscriptionStateWarned SubscriptionState = "Warned" +) + +// PossibleSubscriptionStateValues returns the possible values for the SubscriptionState const type. +func PossibleSubscriptionStateValues() []SubscriptionState { + return []SubscriptionState{ + SubscriptionStateDeleted, + SubscriptionStateDisabled, + SubscriptionStateEnabled, + SubscriptionStatePastDue, + SubscriptionStateWarned, + } } diff --git a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_models.go b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_models.go index c1fb3ecf513b..deb564c299d0 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_models.go +++ b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armmarketplace -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // AcknowledgeOfferNotificationDetails - Notification update request payload details type AcknowledgeOfferNotificationDetails struct { @@ -33,17 +28,6 @@ type AcknowledgeOfferNotificationDetails struct { RemovePlans []*string `json:"removePlans,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AcknowledgeOfferNotificationDetails. -func (a AcknowledgeOfferNotificationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "acknowledge", a.Acknowledge) - populate(objectMap, "addPlans", a.AddPlans) - populate(objectMap, "dismiss", a.Dismiss) - populate(objectMap, "removeOffer", a.RemoveOffer) - populate(objectMap, "removePlans", a.RemovePlans) - return json.Marshal(objectMap) -} - // AcknowledgeOfferNotificationProperties - Notification update request payload type AcknowledgeOfferNotificationProperties struct { // Notification update request payload details @@ -80,21 +64,6 @@ type AdminRequestApprovalProperties struct { Plans []*PlanRequesterDetails `json:"plans,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AdminRequestApprovalProperties. -func (a AdminRequestApprovalProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "adminAction", a.AdminAction) - populate(objectMap, "administrator", a.Administrator) - populate(objectMap, "approvedPlans", a.ApprovedPlans) - populate(objectMap, "collectionIds", a.CollectionIDs) - populate(objectMap, "comment", a.Comment) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "offerId", a.OfferID) - populate(objectMap, "plans", a.Plans) - populate(objectMap, "publisherId", a.PublisherID) - return json.Marshal(objectMap) -} - // AdminRequestApprovalsList - List of admin request approval resources type AdminRequestApprovalsList struct { Value []*AdminRequestApprovalsResource `json:"value,omitempty"` @@ -103,14 +72,6 @@ type AdminRequestApprovalsList struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AdminRequestApprovalsList. -func (a AdminRequestApprovalsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - // AdminRequestApprovalsResource - Admin request approval resource. type AdminRequestApprovalsResource struct { // The privateStore admin Approval request data structure. @@ -135,13 +96,6 @@ type BillingAccountsResponse struct { BillingAccounts []*string `json:"billingAccounts,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type BillingAccountsResponse. -func (b BillingAccountsResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "billingAccounts", b.BillingAccounts) - return json.Marshal(objectMap) -} - // BulkCollectionsDetails - Bulk collection details type BulkCollectionsDetails struct { // Action to perform (For example: EnableCollections, DisableCollections) @@ -151,14 +105,6 @@ type BulkCollectionsDetails struct { CollectionIDs []*string `json:"collectionIds,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type BulkCollectionsDetails. -func (b BulkCollectionsDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "action", b.Action) - populate(objectMap, "collectionIds", b.CollectionIDs) - return json.Marshal(objectMap) -} - // BulkCollectionsPayload - Bulk collections action properties type BulkCollectionsPayload struct { // bulk collections properties details @@ -175,14 +121,6 @@ type BulkCollectionsResponse struct { Succeeded []*CollectionsDetails `json:"succeeded,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type BulkCollectionsResponse. -func (b BulkCollectionsResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "failed", b.Failed) - populate(objectMap, "succeeded", b.Succeeded) - return json.Marshal(objectMap) -} - // Collection - The Collection data structure. type Collection struct { // The collection data structure. @@ -227,19 +165,6 @@ type CollectionProperties struct { NumberOfOffers *int64 `json:"numberOfOffers,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type CollectionProperties. -func (c CollectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allSubscriptions", c.AllSubscriptions) - populate(objectMap, "claim", c.Claim) - populate(objectMap, "collectionId", c.CollectionID) - populate(objectMap, "collectionName", c.CollectionName) - populate(objectMap, "enabled", c.Enabled) - populate(objectMap, "numberOfOffers", c.NumberOfOffers) - populate(objectMap, "subscriptionsList", c.SubscriptionsList) - return json.Marshal(objectMap) -} - // CollectionsDetails - Collection name and id. type CollectionsDetails struct { // Collection id. @@ -255,14 +180,6 @@ type CollectionsList struct { Value []*Collection `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CollectionsList. -func (c CollectionsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - // CollectionsSubscriptionsMappingDetails - Collection name and related subscriptions list type CollectionsSubscriptionsMappingDetails struct { // Collection name @@ -272,14 +189,6 @@ type CollectionsSubscriptionsMappingDetails struct { Subscriptions []*string `json:"subscriptions,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CollectionsSubscriptionsMappingDetails. -func (c CollectionsSubscriptionsMappingDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "collectionName", c.CollectionName) - populate(objectMap, "subscriptions", c.Subscriptions) - return json.Marshal(objectMap) -} - // CollectionsToSubscriptionsMappingPayload - The subscriptions list to get the related collections type CollectionsToSubscriptionsMappingPayload struct { // Subscriptions ids list @@ -292,26 +201,12 @@ type CollectionsToSubscriptionsMappingProperties struct { SubscriptionIDs []*string `json:"subscriptionIds,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CollectionsToSubscriptionsMappingProperties. -func (c CollectionsToSubscriptionsMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "subscriptionIds", c.SubscriptionIDs) - return json.Marshal(objectMap) -} - // CollectionsToSubscriptionsMappingResponse - A map of collections subscriptions details type CollectionsToSubscriptionsMappingResponse struct { // The map of collections subscriptions Details map[string]*CollectionsSubscriptionsMappingDetails `json:"details,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CollectionsToSubscriptionsMappingResponse. -func (c CollectionsToSubscriptionsMappingResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "details", c.Details) - return json.Marshal(objectMap) -} - // ErrorResponse - Error response indicates Microsoft.Marketplace service is not able to process the incoming request. The // reason is provided in the error message. type ErrorResponse struct { @@ -349,16 +244,9 @@ type NewNotifications struct { Plans []*PlanNotificationDetails `json:"plans,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type NewNotifications. -func (n NewNotifications) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", n.DisplayName) - populate(objectMap, "icon", n.Icon) - populate(objectMap, "isFuturePlansEnabled", n.IsFuturePlansEnabled) - populate(objectMap, "messageCode", n.MessageCode) - populate(objectMap, "offerId", n.OfferID) - populate(objectMap, "plans", n.Plans) - return json.Marshal(objectMap) +// NewPlansNotificationsList - List of all new plans notifications for public offers +type NewPlansNotificationsList struct { + NewPlansNotifications []*NewNotifications `json:"newPlansNotifications,omitempty"` } // NotificationsSettingsProperties - Describes the json payload for notifications settings @@ -370,14 +258,6 @@ type NotificationsSettingsProperties struct { SendToAllMarketplaceAdmins *bool `json:"sendToAllMarketplaceAdmins,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type NotificationsSettingsProperties. -func (n NotificationsSettingsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "recipients", n.Recipients) - populate(objectMap, "sendToAllMarketplaceAdmins", n.SendToAllMarketplaceAdmins) - return json.Marshal(objectMap) -} - // Offer - The privateStore offer data structure. type Offer struct { // The privateStore offer data structure. @@ -402,14 +282,6 @@ type OfferListResponse struct { Value []*Offer `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OfferListResponse. -func (o OfferListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - type OfferProperties struct { // Identifier for purposes of race condition ETag *string `json:"eTag,omitempty"` @@ -446,23 +318,6 @@ type OfferProperties struct { UniqueOfferID *string `json:"uniqueOfferId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type OfferProperties. -func (o OfferProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", o.CreatedAt) - populate(objectMap, "eTag", o.ETag) - populate(objectMap, "iconFileUris", o.IconFileUris) - populate(objectMap, "modifiedAt", o.ModifiedAt) - populate(objectMap, "offerDisplayName", o.OfferDisplayName) - populate(objectMap, "plans", o.Plans) - populate(objectMap, "privateStoreId", o.PrivateStoreID) - populate(objectMap, "publisherDisplayName", o.PublisherDisplayName) - populate(objectMap, "specificPlanIdsLimitation", o.SpecificPlanIDsLimitation) - populate(objectMap, "uniqueOfferId", o.UniqueOfferID) - populate(objectMap, "updateSuppressedDueIdempotence", o.UpdateSuppressedDueIdempotence) - return json.Marshal(objectMap) -} - // OperationListResult - Result of the request to list Marketplace operations. It contains a list of operations and a URL // link to get the next set of results. type OperationListResult struct { @@ -473,14 +328,6 @@ type OperationListResult struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -548,15 +395,6 @@ type PlanRequesterDetails struct { Requesters []*UserRequestDetails `json:"requesters,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PlanRequesterDetails. -func (p PlanRequesterDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "planDisplayName", p.PlanDisplayName) - populate(objectMap, "planId", p.PlanID) - populate(objectMap, "requesters", p.Requesters) - return json.Marshal(objectMap) -} - // PrivateStore - The PrivateStore data structure. type PrivateStore struct { // The PrivateStore data structure. @@ -620,6 +458,13 @@ type PrivateStoreClientDeleteOptions struct { // placeholder for future optional parameters } +// PrivateStoreClientFetchAllSubscriptionsInTenantOptions contains the optional parameters for the PrivateStoreClient.FetchAllSubscriptionsInTenant +// method. +type PrivateStoreClientFetchAllSubscriptionsInTenantOptions struct { + // The skip token to get the next page. + NextPageToken *string +} + // PrivateStoreClientGetAdminRequestApprovalOptions contains the optional parameters for the PrivateStoreClient.GetAdminRequestApproval // method. type PrivateStoreClientGetAdminRequestApprovalOptions struct { @@ -643,12 +488,30 @@ type PrivateStoreClientGetRequestApprovalOptions struct { // placeholder for future optional parameters } +// PrivateStoreClientListNewPlansNotificationsOptions contains the optional parameters for the PrivateStoreClient.ListNewPlansNotifications +// method. +type PrivateStoreClientListNewPlansNotificationsOptions struct { + // placeholder for future optional parameters +} + // PrivateStoreClientListOptions contains the optional parameters for the PrivateStoreClient.List method. type PrivateStoreClientListOptions struct { // Determines if to use cache or DB for serving this request UseCache *string } +// PrivateStoreClientListStopSellOffersPlansNotificationsOptions contains the optional parameters for the PrivateStoreClient.ListStopSellOffersPlansNotifications +// method. +type PrivateStoreClientListStopSellOffersPlansNotificationsOptions struct { + StopSellSubscriptions *StopSellSubscriptions +} + +// PrivateStoreClientListSubscriptionsContextOptions contains the optional parameters for the PrivateStoreClient.ListSubscriptionsContext +// method. +type PrivateStoreClientListSubscriptionsContextOptions struct { + // placeholder for future optional parameters +} + // PrivateStoreClientQueryApprovedPlansOptions contains the optional parameters for the PrivateStoreClient.QueryApprovedPlans // method. type PrivateStoreClientQueryApprovedPlansOptions struct { @@ -753,14 +616,6 @@ type PrivateStoreList struct { Value []*PrivateStore `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateStoreList. -func (p PrivateStoreList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PrivateStoreNotificationsState - Get private store notifications state type PrivateStoreNotificationsState struct { ApprovalRequests []*RequestApprovalsDetails `json:"approvalRequests,omitempty"` @@ -768,15 +623,6 @@ type PrivateStoreNotificationsState struct { StopSellNotifications []*StopSellNotifications `json:"stopSellNotifications,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateStoreNotificationsState. -func (p PrivateStoreNotificationsState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "approvalRequests", p.ApprovalRequests) - populate(objectMap, "newNotifications", p.NewNotifications) - populate(objectMap, "stopSellNotifications", p.StopSellNotifications) - return json.Marshal(objectMap) -} - // PrivateStoreProperties - Describes the json payload on whether or not the private store is enabled for a given tenant type PrivateStoreProperties struct { // Indicates private store availability @@ -807,21 +653,6 @@ type PrivateStoreProperties struct { PrivateStoreID *string `json:"privateStoreId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateStoreProperties. -func (p PrivateStoreProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "availability", p.Availability) - populate(objectMap, "branding", p.Branding) - populate(objectMap, "collectionIds", p.CollectionIDs) - populate(objectMap, "eTag", p.ETag) - populate(objectMap, "isGov", p.IsGov) - populate(objectMap, "notificationsSettings", p.NotificationsSettings) - populate(objectMap, "privateStoreId", p.PrivateStoreID) - populate(objectMap, "privateStoreName", p.PrivateStoreName) - populate(objectMap, "tenantId", p.TenantID) - return json.Marshal(objectMap) -} - // QueryApprovedPlans - Query approved plans details type QueryApprovedPlans struct { // Offer id @@ -831,14 +662,6 @@ type QueryApprovedPlans struct { PlanIDs []*string `json:"planIds,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type QueryApprovedPlans. -func (q QueryApprovedPlans) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "offerId", q.OfferID) - populate(objectMap, "planIds", q.PlanIDs) - return json.Marshal(objectMap) -} - // QueryApprovedPlansDetails - Query approved plans response type QueryApprovedPlansDetails struct { // Indicates whether all subscriptions are approved for this plan @@ -853,15 +676,6 @@ type QueryApprovedPlansDetails struct { SubscriptionIDs []*string `json:"subscriptionIds,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type QueryApprovedPlansDetails. -func (q QueryApprovedPlansDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allSubscriptions", q.AllSubscriptions) - populate(objectMap, "planId", q.PlanID) - populate(objectMap, "subscriptionIds", q.SubscriptionIDs) - return json.Marshal(objectMap) -} - // QueryApprovedPlansPayload - Query approved plans payload type QueryApprovedPlansPayload struct { // Query approved plans details @@ -874,13 +688,6 @@ type QueryApprovedPlansResponse struct { Details []*QueryApprovedPlansDetails `json:"details,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type QueryApprovedPlansResponse. -func (q QueryApprovedPlansResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "details", q.Details) - return json.Marshal(objectMap) -} - // QueryOffers - List of offers type QueryOffers struct { // URL to get the next set of PrivateStore list results if there are any. @@ -888,14 +695,6 @@ type QueryOffers struct { Value []*OfferProperties `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type QueryOffers. -func (q QueryOffers) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", q.NextLink) - populate(objectMap, "value", q.Value) - return json.Marshal(objectMap) -} - // QueryRequestApproval - Gets the request plans with indication on each plan whether is approved by the admin, has pending // request or not requested yet type QueryRequestApproval struct { @@ -912,16 +711,6 @@ type QueryRequestApproval struct { UniqueOfferID *string `json:"uniqueOfferId,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type QueryRequestApproval. -func (q QueryRequestApproval) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", q.Etag) - populate(objectMap, "messageCode", q.MessageCode) - populate(objectMap, "plansDetails", q.PlansDetails) - populate(objectMap, "uniqueOfferId", q.UniqueOfferID) - return json.Marshal(objectMap) -} - // QueryRequestApprovalProperties - The details to get the request plans statuses type QueryRequestApprovalProperties struct { // The details to get the request plans statuses @@ -961,18 +750,6 @@ type RequestApprovalProperties struct { OfferDisplayName *string `json:"offerDisplayName,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type RequestApprovalProperties. -func (r RequestApprovalProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "isClosed", r.IsClosed) - populate(objectMap, "messageCode", r.MessageCode) - populate(objectMap, "offerDisplayName", r.OfferDisplayName) - populate(objectMap, "offerId", r.OfferID) - populate(objectMap, "plansDetails", r.PlansDetails) - populate(objectMap, "publisherId", r.PublisherID) - return json.Marshal(objectMap) -} - // RequestApprovalResource - Request approval resource. type RequestApprovalResource struct { // The privateStore approval request data structure. @@ -1012,18 +789,6 @@ type RequestApprovalsDetails struct { PublisherID *string `json:"publisherId,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type RequestApprovalsDetails. -func (r RequestApprovalsDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", r.DisplayName) - populate(objectMap, "icon", r.Icon) - populate(objectMap, "messageCode", r.MessageCode) - populate(objectMap, "offerId", r.OfferID) - populate(objectMap, "plans", r.Plans) - populate(objectMap, "publisherId", r.PublisherID) - return json.Marshal(objectMap) -} - // RequestApprovalsList - List of admin request approval resources type RequestApprovalsList struct { Value []*RequestApprovalResource `json:"value,omitempty"` @@ -1032,14 +797,6 @@ type RequestApprovalsList struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type RequestApprovalsList. -func (r RequestApprovalsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - // RequestDetails - Request details needed to get the plans statuses type RequestDetails struct { // Current plans list @@ -1052,15 +809,6 @@ type RequestDetails struct { SubscriptionID *string `json:"subscriptionId,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type RequestDetails. -func (r RequestDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "planIds", r.PlanIDs) - populate(objectMap, "publisherId", r.PublisherID) - populate(objectMap, "subscriptionId", r.SubscriptionID) - return json.Marshal(objectMap) -} - // Resource - An Azure resource. type Resource struct { // READ-ONLY; The resource ID. @@ -1091,7 +839,7 @@ type SingleOperation struct { Origin *string `json:"origin,omitempty"` // Properties of the operation - Properties map[string]interface{} `json:"properties,omitempty"` + Properties interface{} `json:"properties,omitempty"` } // SingleOperationDisplay - The object that represents the operation. @@ -1130,16 +878,73 @@ type StopSellNotifications struct { Plans []*PlanNotificationDetails `json:"plans,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type StopSellNotifications. -func (s StopSellNotifications) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "icon", s.Icon) - populate(objectMap, "isEntire", s.IsEntire) - populate(objectMap, "messageCode", s.MessageCode) - populate(objectMap, "offerId", s.OfferID) - populate(objectMap, "plans", s.Plans) - return json.Marshal(objectMap) +// StopSellOffersPlansNotificationsList - List of stop sell offers and plans notifications. +type StopSellOffersPlansNotificationsList struct { + StopSellNotifications []*StopSellOffersPlansNotificationsListProperties `json:"stopSellNotifications,omitempty"` +} + +// StopSellOffersPlansNotificationsListProperties - List of stop sell offers and plans notifications. +type StopSellOffersPlansNotificationsListProperties struct { + // READ-ONLY; The offer display name + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; The icon url + Icon *string `json:"icon,omitempty" azure:"ro"` + + // READ-ONLY; A value indicating whether entire offer is in stop sell or only few of its plans + IsEntire *bool `json:"isEntire,omitempty" azure:"ro"` + + // READ-ONLY; The notification message code + MessageCode *int64 `json:"messageCode,omitempty" azure:"ro"` + + // READ-ONLY; The offer id + OfferID *string `json:"offerId,omitempty" azure:"ro"` + + // READ-ONLY; The list of removed plans notifications + Plans []*PlanNotificationDetails `json:"plans,omitempty" azure:"ro"` + + // READ-ONLY; True if the offer has public plans + PublicContext *bool `json:"publicContext,omitempty" azure:"ro"` + + // READ-ONLY; The subscriptions related to private plans + SubscriptionsIDs []*string `json:"subscriptionsIds,omitempty" azure:"ro"` +} + +// StopSellSubscriptions - Private plans subscriptions +type StopSellSubscriptions struct { + Subscriptions []*string `json:"subscriptions,omitempty"` +} + +// Subscription information. +type Subscription struct { + // READ-ONLY; The subscription display name. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; The fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. + State *SubscriptionState `json:"state,omitempty" azure:"ro"` + + // READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty" azure:"ro"` +} + +// SubscriptionsContextList - List of subscription Ids in the private store +type SubscriptionsContextList struct { + SubscriptionsIDs []*string `json:"subscriptionsIds,omitempty"` +} + +// SubscriptionsResponse - Subscription list operation response. +type SubscriptionsResponse struct { + // READ-ONLY; Number of subscriptions on the page + Count *int64 `json:"count,omitempty" azure:"ro"` + + // READ-ONLY; The skip token to retrieve the next page. + SkipToken *string `json:"skipToken,omitempty" azure:"ro"` + + // READ-ONLY; An array of subscriptions. + Value []*Subscription `json:"value,omitempty" azure:"ro"` } // SystemData - Read only system data @@ -1163,53 +968,6 @@ type SystemData struct { LastModifiedByType *IdentityType `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 -} - // TransferOffersDetails - Transfer offers response details type TransferOffersDetails struct { // Offers ids list to transfer from source collection to target collection(s) @@ -1222,15 +980,6 @@ type TransferOffersDetails struct { TargetCollections []*string `json:"targetCollections,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type TransferOffersDetails. -func (t TransferOffersDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "offerIdsList", t.OfferIDsList) - populate(objectMap, "operation", t.Operation) - populate(objectMap, "targetCollections", t.TargetCollections) - return json.Marshal(objectMap) -} - // TransferOffersProperties - Transfer offers properties type TransferOffersProperties struct { // transfer offers properties details @@ -1247,14 +996,6 @@ type TransferOffersResponse struct { Succeeded []*CollectionsDetails `json:"succeeded,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type TransferOffersResponse. -func (t TransferOffersResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "failed", t.Failed) - populate(objectMap, "succeeded", t.Succeeded) - return json.Marshal(objectMap) -} - // UserRequestDetails - user request details type UserRequestDetails struct { // Gets the subscription id that the user is requesting to add the plan to @@ -1287,20 +1028,3 @@ type WithdrawProperties struct { // Withdraw properties details Properties *WithdrawDetails `json:"properties,omitempty"` } - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_models_serde.go b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_models_serde.go new file mode 100644 index 000000000000..b3ab00edecc9 --- /dev/null +++ b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_models_serde.go @@ -0,0 +1,436 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmarketplace + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AcknowledgeOfferNotificationDetails. +func (a AcknowledgeOfferNotificationDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "acknowledge", a.Acknowledge) + populate(objectMap, "addPlans", a.AddPlans) + populate(objectMap, "dismiss", a.Dismiss) + populate(objectMap, "removeOffer", a.RemoveOffer) + populate(objectMap, "removePlans", a.RemovePlans) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AdminRequestApprovalProperties. +func (a AdminRequestApprovalProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "adminAction", a.AdminAction) + populate(objectMap, "administrator", a.Administrator) + populate(objectMap, "approvedPlans", a.ApprovedPlans) + populate(objectMap, "collectionIds", a.CollectionIDs) + populate(objectMap, "comment", a.Comment) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "offerId", a.OfferID) + populate(objectMap, "plans", a.Plans) + populate(objectMap, "publisherId", a.PublisherID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AdminRequestApprovalsList. +func (a AdminRequestApprovalsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type BillingAccountsResponse. +func (b BillingAccountsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingAccounts", b.BillingAccounts) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type BulkCollectionsDetails. +func (b BulkCollectionsDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", b.Action) + populate(objectMap, "collectionIds", b.CollectionIDs) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type BulkCollectionsResponse. +func (b BulkCollectionsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "failed", b.Failed) + populate(objectMap, "succeeded", b.Succeeded) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CollectionProperties. +func (c CollectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allSubscriptions", c.AllSubscriptions) + populate(objectMap, "claim", c.Claim) + populate(objectMap, "collectionId", c.CollectionID) + populate(objectMap, "collectionName", c.CollectionName) + populate(objectMap, "enabled", c.Enabled) + populate(objectMap, "numberOfOffers", c.NumberOfOffers) + populate(objectMap, "subscriptionsList", c.SubscriptionsList) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CollectionsList. +func (c CollectionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CollectionsSubscriptionsMappingDetails. +func (c CollectionsSubscriptionsMappingDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "collectionName", c.CollectionName) + populate(objectMap, "subscriptions", c.Subscriptions) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CollectionsToSubscriptionsMappingProperties. +func (c CollectionsToSubscriptionsMappingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "subscriptionIds", c.SubscriptionIDs) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CollectionsToSubscriptionsMappingResponse. +func (c CollectionsToSubscriptionsMappingResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "details", c.Details) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type NewNotifications. +func (n NewNotifications) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", n.DisplayName) + populate(objectMap, "icon", n.Icon) + populate(objectMap, "isFuturePlansEnabled", n.IsFuturePlansEnabled) + populate(objectMap, "messageCode", n.MessageCode) + populate(objectMap, "offerId", n.OfferID) + populate(objectMap, "plans", n.Plans) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type NewPlansNotificationsList. +func (n NewPlansNotificationsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "newPlansNotifications", n.NewPlansNotifications) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type NotificationsSettingsProperties. +func (n NotificationsSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "recipients", n.Recipients) + populate(objectMap, "sendToAllMarketplaceAdmins", n.SendToAllMarketplaceAdmins) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OfferListResponse. +func (o OfferListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OfferProperties. +func (o OfferProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "createdAt", o.CreatedAt) + populate(objectMap, "eTag", o.ETag) + populate(objectMap, "iconFileUris", o.IconFileUris) + populate(objectMap, "modifiedAt", o.ModifiedAt) + populate(objectMap, "offerDisplayName", o.OfferDisplayName) + populate(objectMap, "plans", o.Plans) + populate(objectMap, "privateStoreId", o.PrivateStoreID) + populate(objectMap, "publisherDisplayName", o.PublisherDisplayName) + populate(objectMap, "specificPlanIdsLimitation", o.SpecificPlanIDsLimitation) + populate(objectMap, "uniqueOfferId", o.UniqueOfferID) + populate(objectMap, "updateSuppressedDueIdempotence", o.UpdateSuppressedDueIdempotence) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PlanRequesterDetails. +func (p PlanRequesterDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "planDisplayName", p.PlanDisplayName) + populate(objectMap, "planId", p.PlanID) + populate(objectMap, "requesters", p.Requesters) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateStoreList. +func (p PrivateStoreList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateStoreNotificationsState. +func (p PrivateStoreNotificationsState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "approvalRequests", p.ApprovalRequests) + populate(objectMap, "newNotifications", p.NewNotifications) + populate(objectMap, "stopSellNotifications", p.StopSellNotifications) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateStoreProperties. +func (p PrivateStoreProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availability", p.Availability) + populate(objectMap, "branding", p.Branding) + populate(objectMap, "collectionIds", p.CollectionIDs) + populate(objectMap, "eTag", p.ETag) + populate(objectMap, "isGov", p.IsGov) + populate(objectMap, "notificationsSettings", p.NotificationsSettings) + populate(objectMap, "privateStoreId", p.PrivateStoreID) + populate(objectMap, "privateStoreName", p.PrivateStoreName) + populate(objectMap, "tenantId", p.TenantID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type QueryApprovedPlans. +func (q QueryApprovedPlans) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "offerId", q.OfferID) + populate(objectMap, "planIds", q.PlanIDs) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type QueryApprovedPlansDetails. +func (q QueryApprovedPlansDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allSubscriptions", q.AllSubscriptions) + populate(objectMap, "planId", q.PlanID) + populate(objectMap, "subscriptionIds", q.SubscriptionIDs) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type QueryApprovedPlansResponse. +func (q QueryApprovedPlansResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "details", q.Details) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type QueryOffers. +func (q QueryOffers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", q.NextLink) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type QueryRequestApproval. +func (q QueryRequestApproval) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", q.Etag) + populate(objectMap, "messageCode", q.MessageCode) + populate(objectMap, "plansDetails", q.PlansDetails) + populate(objectMap, "uniqueOfferId", q.UniqueOfferID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RequestApprovalProperties. +func (r RequestApprovalProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isClosed", r.IsClosed) + populate(objectMap, "messageCode", r.MessageCode) + populate(objectMap, "offerDisplayName", r.OfferDisplayName) + populate(objectMap, "offerId", r.OfferID) + populate(objectMap, "plansDetails", r.PlansDetails) + populate(objectMap, "publisherId", r.PublisherID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RequestApprovalsDetails. +func (r RequestApprovalsDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", r.DisplayName) + populate(objectMap, "icon", r.Icon) + populate(objectMap, "messageCode", r.MessageCode) + populate(objectMap, "offerId", r.OfferID) + populate(objectMap, "plans", r.Plans) + populate(objectMap, "publisherId", r.PublisherID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RequestApprovalsList. +func (r RequestApprovalsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RequestDetails. +func (r RequestDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "planIds", r.PlanIDs) + populate(objectMap, "publisherId", r.PublisherID) + populate(objectMap, "subscriptionId", r.SubscriptionID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StopSellNotifications. +func (s StopSellNotifications) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "icon", s.Icon) + populate(objectMap, "isEntire", s.IsEntire) + populate(objectMap, "messageCode", s.MessageCode) + populate(objectMap, "offerId", s.OfferID) + populate(objectMap, "plans", s.Plans) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StopSellOffersPlansNotificationsList. +func (s StopSellOffersPlansNotificationsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "stopSellNotifications", s.StopSellNotifications) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StopSellOffersPlansNotificationsListProperties. +func (s StopSellOffersPlansNotificationsListProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "icon", s.Icon) + populate(objectMap, "isEntire", s.IsEntire) + populate(objectMap, "messageCode", s.MessageCode) + populate(objectMap, "offerId", s.OfferID) + populate(objectMap, "plans", s.Plans) + populate(objectMap, "publicContext", s.PublicContext) + populate(objectMap, "subscriptionsIds", s.SubscriptionsIDs) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StopSellSubscriptions. +func (s StopSellSubscriptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "subscriptions", s.Subscriptions) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionsContextList. +func (s SubscriptionsContextList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "subscriptionsIds", s.SubscriptionsIDs) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionsResponse. +func (s SubscriptionsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "count", s.Count) + populate(objectMap, "skipToken", s.SkipToken) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// 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 +} + +// MarshalJSON implements the json.Marshaller interface for type TransferOffersDetails. +func (t TransferOffersDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "offerIdsList", t.OfferIDsList) + populate(objectMap, "operation", t.Operation) + populate(objectMap, "targetCollections", t.TargetCollections) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type TransferOffersResponse. +func (t TransferOffersResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "failed", t.Failed) + populate(objectMap, "succeeded", t.Succeeded) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_operations_client.go b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_operations_client.go index 98ce3ab1472a..c034539c659f 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_operations_client.go +++ b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,19 +29,23 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Lists all of the available Microsoft.Marketplace REST API operations. @@ -69,7 +74,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -77,7 +82,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_pagers.go b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_pagers.go deleted file mode 100644 index 29556df53625..000000000000 --- a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_pagers.go +++ /dev/null @@ -1,125 +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 armmarketplace - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// PrivateStoreClientListPager provides operations for iterating over paged responses. -type PrivateStoreClientListPager struct { - client *PrivateStoreClient - current PrivateStoreClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PrivateStoreClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PrivateStoreClientListPager) 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 *PrivateStoreClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PrivateStoreList.NextLink == nil || len(*p.current.PrivateStoreList.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 = runtime.NewResponseError(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 PrivateStoreClientListResponse page. -func (p *PrivateStoreClientListPager) PageResponse() PrivateStoreClientListResponse { - return p.current -} - -// PrivateStoreCollectionOfferClientListPager provides operations for iterating over paged responses. -type PrivateStoreCollectionOfferClientListPager struct { - client *PrivateStoreCollectionOfferClient - current PrivateStoreCollectionOfferClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PrivateStoreCollectionOfferClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PrivateStoreCollectionOfferClientListPager) 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 *PrivateStoreCollectionOfferClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.OfferListResponse.NextLink == nil || len(*p.current.OfferListResponse.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 = runtime.NewResponseError(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 PrivateStoreCollectionOfferClientListResponse page. -func (p *PrivateStoreCollectionOfferClientListPager) PageResponse() PrivateStoreCollectionOfferClientListResponse { - return p.current -} diff --git a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_privatestore_client.go b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_privatestore_client.go index 8a267f40de2c..86154e33b852 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_privatestore_client.go +++ b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_privatestore_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -31,19 +32,23 @@ type PrivateStoreClient struct { // NewPrivateStoreClient creates a new instance of PrivateStoreClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateStoreClient(credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateStoreClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPrivateStoreClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateStoreClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateStoreClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // AcknowledgeOfferNotification - Acknowledge notification for offer @@ -64,7 +69,7 @@ func (client *PrivateStoreClient) AcknowledgeOfferNotification(ctx context.Conte if !runtime.HasStatusCode(resp, http.StatusOK) { return PrivateStoreClientAcknowledgeOfferNotificationResponse{}, runtime.NewResponseError(resp) } - return PrivateStoreClientAcknowledgeOfferNotificationResponse{RawResponse: resp}, nil + return PrivateStoreClientAcknowledgeOfferNotificationResponse{}, nil } // acknowledgeOfferNotificationCreateRequest creates the AcknowledgeOfferNotification request. @@ -83,7 +88,7 @@ func (client *PrivateStoreClient) acknowledgeOfferNotificationCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { @@ -124,7 +129,7 @@ func (client *PrivateStoreClient) adminRequestApprovalsListCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -132,7 +137,7 @@ func (client *PrivateStoreClient) adminRequestApprovalsListCreateRequest(ctx con // adminRequestApprovalsListHandleResponse handles the AdminRequestApprovalsList response. func (client *PrivateStoreClient) adminRequestApprovalsListHandleResponse(resp *http.Response) (PrivateStoreClientAdminRequestApprovalsListResponse, error) { - result := PrivateStoreClientAdminRequestApprovalsListResponse{RawResponse: resp} + result := PrivateStoreClientAdminRequestApprovalsListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AdminRequestApprovalsList); err != nil { return PrivateStoreClientAdminRequestApprovalsListResponse{}, err } @@ -171,7 +176,7 @@ func (client *PrivateStoreClient) billingAccountsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + 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 +184,7 @@ func (client *PrivateStoreClient) billingAccountsCreateRequest(ctx context.Conte // billingAccountsHandleResponse handles the BillingAccounts response. func (client *PrivateStoreClient) billingAccountsHandleResponse(resp *http.Response) (PrivateStoreClientBillingAccountsResponse, error) { - result := PrivateStoreClientBillingAccountsResponse{RawResponse: resp} + result := PrivateStoreClientBillingAccountsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.BillingAccountsResponse); err != nil { return PrivateStoreClientBillingAccountsResponse{}, err } @@ -218,7 +223,7 @@ func (client *PrivateStoreClient) bulkCollectionsActionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { @@ -229,7 +234,7 @@ func (client *PrivateStoreClient) bulkCollectionsActionCreateRequest(ctx context // bulkCollectionsActionHandleResponse handles the BulkCollectionsAction response. func (client *PrivateStoreClient) bulkCollectionsActionHandleResponse(resp *http.Response) (PrivateStoreClientBulkCollectionsActionResponse, error) { - result := PrivateStoreClientBulkCollectionsActionResponse{RawResponse: resp} + result := PrivateStoreClientBulkCollectionsActionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.BulkCollectionsResponse); err != nil { return PrivateStoreClientBulkCollectionsActionResponse{}, err } @@ -269,7 +274,7 @@ func (client *PrivateStoreClient) collectionsToSubscriptionsMappingCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { @@ -280,7 +285,7 @@ func (client *PrivateStoreClient) collectionsToSubscriptionsMappingCreateRequest // collectionsToSubscriptionsMappingHandleResponse handles the CollectionsToSubscriptionsMapping response. func (client *PrivateStoreClient) collectionsToSubscriptionsMappingHandleResponse(resp *http.Response) (PrivateStoreClientCollectionsToSubscriptionsMappingResponse, error) { - result := PrivateStoreClientCollectionsToSubscriptionsMappingResponse{RawResponse: resp} + result := PrivateStoreClientCollectionsToSubscriptionsMappingResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.CollectionsToSubscriptionsMappingResponse); err != nil { return PrivateStoreClientCollectionsToSubscriptionsMappingResponse{}, err } @@ -324,7 +329,7 @@ func (client *PrivateStoreClient) createApprovalRequestCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { @@ -335,7 +340,7 @@ func (client *PrivateStoreClient) createApprovalRequestCreateRequest(ctx context // createApprovalRequestHandleResponse handles the CreateApprovalRequest response. func (client *PrivateStoreClient) createApprovalRequestHandleResponse(resp *http.Response) (PrivateStoreClientCreateApprovalRequestResponse, error) { - result := PrivateStoreClientCreateApprovalRequestResponse{RawResponse: resp} + result := PrivateStoreClientCreateApprovalRequestResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RequestApprovalResource); err != nil { return PrivateStoreClientCreateApprovalRequestResponse{}, err } @@ -359,7 +364,7 @@ func (client *PrivateStoreClient) CreateOrUpdate(ctx context.Context, privateSto if !runtime.HasStatusCode(resp, http.StatusOK) { return PrivateStoreClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) } - return PrivateStoreClientCreateOrUpdateResponse{RawResponse: resp}, nil + return PrivateStoreClientCreateOrUpdateResponse{}, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -374,7 +379,7 @@ func (client *PrivateStoreClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { @@ -399,7 +404,7 @@ func (client *PrivateStoreClient) Delete(ctx context.Context, privateStoreID str if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return PrivateStoreClientDeleteResponse{}, runtime.NewResponseError(resp) } - return PrivateStoreClientDeleteResponse{RawResponse: resp}, nil + return PrivateStoreClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -414,12 +419,62 @@ func (client *PrivateStoreClient) deleteCreateRequest(ctx context.Context, priva return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// FetchAllSubscriptionsInTenant - Fetch all subscriptions in tenant, only for marketplace admin +// If the operation fails it returns an *azcore.ResponseError type. +// privateStoreID - The store ID - must use the tenant ID +// options - PrivateStoreClientFetchAllSubscriptionsInTenantOptions contains the optional parameters for the PrivateStoreClient.FetchAllSubscriptionsInTenant +// method. +func (client *PrivateStoreClient) FetchAllSubscriptionsInTenant(ctx context.Context, privateStoreID string, options *PrivateStoreClientFetchAllSubscriptionsInTenantOptions) (PrivateStoreClientFetchAllSubscriptionsInTenantResponse, error) { + req, err := client.fetchAllSubscriptionsInTenantCreateRequest(ctx, privateStoreID, options) + if err != nil { + return PrivateStoreClientFetchAllSubscriptionsInTenantResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateStoreClientFetchAllSubscriptionsInTenantResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateStoreClientFetchAllSubscriptionsInTenantResponse{}, runtime.NewResponseError(resp) + } + return client.fetchAllSubscriptionsInTenantHandleResponse(resp) +} + +// fetchAllSubscriptionsInTenantCreateRequest creates the FetchAllSubscriptionsInTenant request. +func (client *PrivateStoreClient) fetchAllSubscriptionsInTenantCreateRequest(ctx context.Context, privateStoreID string, options *PrivateStoreClientFetchAllSubscriptionsInTenantOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/fetchAllSubscriptionsInTenant" + if privateStoreID == "" { + return nil, errors.New("parameter privateStoreID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateStoreId}", url.PathEscape(privateStoreID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.NextPageToken != nil { + req.Raw().Header.Set("next-page-token", *options.NextPageToken) + } req.Raw().Header.Set("Accept", "application/json") return req, nil } +// fetchAllSubscriptionsInTenantHandleResponse handles the FetchAllSubscriptionsInTenant response. +func (client *PrivateStoreClient) fetchAllSubscriptionsInTenantHandleResponse(resp *http.Response) (PrivateStoreClientFetchAllSubscriptionsInTenantResponse, error) { + result := PrivateStoreClientFetchAllSubscriptionsInTenantResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionsResponse); err != nil { + return PrivateStoreClientFetchAllSubscriptionsInTenantResponse{}, err + } + return result, nil +} + // Get - Get information about the private store // If the operation fails it returns an *azcore.ResponseError type. // privateStoreID - The store ID - must use the tenant ID @@ -451,7 +506,7 @@ func (client *PrivateStoreClient) getCreateRequest(ctx context.Context, privateS return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -459,7 +514,7 @@ func (client *PrivateStoreClient) getCreateRequest(ctx context.Context, privateS // getHandleResponse handles the Get response. func (client *PrivateStoreClient) getHandleResponse(resp *http.Response) (PrivateStoreClientGetResponse, error) { - result := PrivateStoreClientGetResponse{RawResponse: resp} + result := PrivateStoreClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateStore); err != nil { return PrivateStoreClientGetResponse{}, err } @@ -504,7 +559,7 @@ func (client *PrivateStoreClient) getAdminRequestApprovalCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") reqQP.Set("publisherId", publisherID) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") @@ -513,7 +568,7 @@ func (client *PrivateStoreClient) getAdminRequestApprovalCreateRequest(ctx conte // getAdminRequestApprovalHandleResponse handles the GetAdminRequestApproval response. func (client *PrivateStoreClient) getAdminRequestApprovalHandleResponse(resp *http.Response) (PrivateStoreClientGetAdminRequestApprovalResponse, error) { - result := PrivateStoreClientGetAdminRequestApprovalResponse{RawResponse: resp} + result := PrivateStoreClientGetAdminRequestApprovalResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AdminRequestApprovalsResource); err != nil { return PrivateStoreClientGetAdminRequestApprovalResponse{}, err } @@ -552,7 +607,7 @@ func (client *PrivateStoreClient) getApprovalRequestsListCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -560,7 +615,7 @@ func (client *PrivateStoreClient) getApprovalRequestsListCreateRequest(ctx conte // getApprovalRequestsListHandleResponse handles the GetApprovalRequestsList response. func (client *PrivateStoreClient) getApprovalRequestsListHandleResponse(resp *http.Response) (PrivateStoreClientGetApprovalRequestsListResponse, error) { - result := PrivateStoreClientGetApprovalRequestsListResponse{RawResponse: resp} + result := PrivateStoreClientGetApprovalRequestsListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RequestApprovalsList); err != nil { return PrivateStoreClientGetApprovalRequestsListResponse{}, err } @@ -604,7 +659,7 @@ func (client *PrivateStoreClient) getRequestApprovalCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -612,7 +667,7 @@ func (client *PrivateStoreClient) getRequestApprovalCreateRequest(ctx context.Co // getRequestApprovalHandleResponse handles the GetRequestApproval response. func (client *PrivateStoreClient) getRequestApprovalHandleResponse(resp *http.Response) (PrivateStoreClientGetRequestApprovalResponse, error) { - result := PrivateStoreClientGetRequestApprovalResponse{RawResponse: resp} + result := PrivateStoreClientGetRequestApprovalResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RequestApprovalResource); err != nil { return PrivateStoreClientGetRequestApprovalResponse{}, err } @@ -622,16 +677,32 @@ func (client *PrivateStoreClient) getRequestApprovalHandleResponse(resp *http.Re // List - Gets the list of available private stores. // If the operation fails it returns an *azcore.ResponseError type. // options - PrivateStoreClientListOptions contains the optional parameters for the PrivateStoreClient.List method. -func (client *PrivateStoreClient) List(options *PrivateStoreClientListOptions) *PrivateStoreClientListPager { - return &PrivateStoreClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *PrivateStoreClient) List(options *PrivateStoreClientListOptions) *runtime.Pager[PrivateStoreClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[PrivateStoreClientListResponse]{ + More: func(page PrivateStoreClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp PrivateStoreClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateStoreList.NextLink) + Fetcher: func(ctx context.Context, page *PrivateStoreClientListResponse) (PrivateStoreClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateStoreClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateStoreClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateStoreClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -642,7 +713,7 @@ func (client *PrivateStoreClient) listCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.UseCache != nil { reqQP.Set("use-cache", *options.UseCache) } @@ -653,13 +724,157 @@ func (client *PrivateStoreClient) listCreateRequest(ctx context.Context, options // listHandleResponse handles the List response. func (client *PrivateStoreClient) listHandleResponse(resp *http.Response) (PrivateStoreClientListResponse, error) { - result := PrivateStoreClientListResponse{RawResponse: resp} + result := PrivateStoreClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateStoreList); err != nil { return PrivateStoreClientListResponse{}, err } return result, nil } +// ListNewPlansNotifications - List new plans notifications +// If the operation fails it returns an *azcore.ResponseError type. +// privateStoreID - The store ID - must use the tenant ID +// options - PrivateStoreClientListNewPlansNotificationsOptions contains the optional parameters for the PrivateStoreClient.ListNewPlansNotifications +// method. +func (client *PrivateStoreClient) ListNewPlansNotifications(ctx context.Context, privateStoreID string, options *PrivateStoreClientListNewPlansNotificationsOptions) (PrivateStoreClientListNewPlansNotificationsResponse, error) { + req, err := client.listNewPlansNotificationsCreateRequest(ctx, privateStoreID, options) + if err != nil { + return PrivateStoreClientListNewPlansNotificationsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateStoreClientListNewPlansNotificationsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateStoreClientListNewPlansNotificationsResponse{}, runtime.NewResponseError(resp) + } + return client.listNewPlansNotificationsHandleResponse(resp) +} + +// listNewPlansNotificationsCreateRequest creates the ListNewPlansNotifications request. +func (client *PrivateStoreClient) listNewPlansNotificationsCreateRequest(ctx context.Context, privateStoreID string, options *PrivateStoreClientListNewPlansNotificationsOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listNewPlansNotifications" + if privateStoreID == "" { + return nil, errors.New("parameter privateStoreID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateStoreId}", url.PathEscape(privateStoreID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listNewPlansNotificationsHandleResponse handles the ListNewPlansNotifications response. +func (client *PrivateStoreClient) listNewPlansNotificationsHandleResponse(resp *http.Response) (PrivateStoreClientListNewPlansNotificationsResponse, error) { + result := PrivateStoreClientListNewPlansNotificationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NewPlansNotificationsList); err != nil { + return PrivateStoreClientListNewPlansNotificationsResponse{}, err + } + return result, nil +} + +// ListStopSellOffersPlansNotifications - List stop sell notifications for both stop sell offers and stop sell plans +// If the operation fails it returns an *azcore.ResponseError type. +// privateStoreID - The store ID - must use the tenant ID +// options - PrivateStoreClientListStopSellOffersPlansNotificationsOptions contains the optional parameters for the PrivateStoreClient.ListStopSellOffersPlansNotifications +// method. +func (client *PrivateStoreClient) ListStopSellOffersPlansNotifications(ctx context.Context, privateStoreID string, options *PrivateStoreClientListStopSellOffersPlansNotificationsOptions) (PrivateStoreClientListStopSellOffersPlansNotificationsResponse, error) { + req, err := client.listStopSellOffersPlansNotificationsCreateRequest(ctx, privateStoreID, options) + if err != nil { + return PrivateStoreClientListStopSellOffersPlansNotificationsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateStoreClientListStopSellOffersPlansNotificationsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateStoreClientListStopSellOffersPlansNotificationsResponse{}, runtime.NewResponseError(resp) + } + return client.listStopSellOffersPlansNotificationsHandleResponse(resp) +} + +// listStopSellOffersPlansNotificationsCreateRequest creates the ListStopSellOffersPlansNotifications request. +func (client *PrivateStoreClient) listStopSellOffersPlansNotificationsCreateRequest(ctx context.Context, privateStoreID string, options *PrivateStoreClientListStopSellOffersPlansNotificationsOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listStopSellOffersPlansNotifications" + if privateStoreID == "" { + return nil, errors.New("parameter privateStoreID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateStoreId}", url.PathEscape(privateStoreID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.StopSellSubscriptions != nil { + return req, runtime.MarshalAsJSON(req, *options.StopSellSubscriptions) + } + return req, nil +} + +// listStopSellOffersPlansNotificationsHandleResponse handles the ListStopSellOffersPlansNotifications response. +func (client *PrivateStoreClient) listStopSellOffersPlansNotificationsHandleResponse(resp *http.Response) (PrivateStoreClientListStopSellOffersPlansNotificationsResponse, error) { + result := PrivateStoreClientListStopSellOffersPlansNotificationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StopSellOffersPlansNotificationsList); err != nil { + return PrivateStoreClientListStopSellOffersPlansNotificationsResponse{}, err + } + return result, nil +} + +// ListSubscriptionsContext - List all the subscriptions in the private store context +// If the operation fails it returns an *azcore.ResponseError type. +// privateStoreID - The store ID - must use the tenant ID +// options - PrivateStoreClientListSubscriptionsContextOptions contains the optional parameters for the PrivateStoreClient.ListSubscriptionsContext +// method. +func (client *PrivateStoreClient) ListSubscriptionsContext(ctx context.Context, privateStoreID string, options *PrivateStoreClientListSubscriptionsContextOptions) (PrivateStoreClientListSubscriptionsContextResponse, error) { + req, err := client.listSubscriptionsContextCreateRequest(ctx, privateStoreID, options) + if err != nil { + return PrivateStoreClientListSubscriptionsContextResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateStoreClientListSubscriptionsContextResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateStoreClientListSubscriptionsContextResponse{}, runtime.NewResponseError(resp) + } + return client.listSubscriptionsContextHandleResponse(resp) +} + +// listSubscriptionsContextCreateRequest creates the ListSubscriptionsContext request. +func (client *PrivateStoreClient) listSubscriptionsContextCreateRequest(ctx context.Context, privateStoreID string, options *PrivateStoreClientListSubscriptionsContextOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listSubscriptionsContext" + if privateStoreID == "" { + return nil, errors.New("parameter privateStoreID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateStoreId}", url.PathEscape(privateStoreID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listSubscriptionsContextHandleResponse handles the ListSubscriptionsContext response. +func (client *PrivateStoreClient) listSubscriptionsContextHandleResponse(resp *http.Response) (PrivateStoreClientListSubscriptionsContextResponse, error) { + result := PrivateStoreClientListSubscriptionsContextResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionsContextList); err != nil { + return PrivateStoreClientListSubscriptionsContextResponse{}, err + } + return result, nil +} + // QueryApprovedPlans - Get map of plans and related approved subscriptions. // If the operation fails it returns an *azcore.ResponseError type. // privateStoreID - The store ID - must use the tenant ID @@ -692,7 +907,7 @@ func (client *PrivateStoreClient) queryApprovedPlansCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { @@ -703,7 +918,7 @@ func (client *PrivateStoreClient) queryApprovedPlansCreateRequest(ctx context.Co // queryApprovedPlansHandleResponse handles the QueryApprovedPlans response. func (client *PrivateStoreClient) queryApprovedPlansHandleResponse(resp *http.Response) (PrivateStoreClientQueryApprovedPlansResponse, error) { - result := PrivateStoreClientQueryApprovedPlansResponse{RawResponse: resp} + result := PrivateStoreClientQueryApprovedPlansResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.QueryApprovedPlansResponse); err != nil { return PrivateStoreClientQueryApprovedPlansResponse{}, err } @@ -742,7 +957,7 @@ func (client *PrivateStoreClient) queryNotificationsStateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -750,7 +965,7 @@ func (client *PrivateStoreClient) queryNotificationsStateCreateRequest(ctx conte // queryNotificationsStateHandleResponse handles the QueryNotificationsState response. func (client *PrivateStoreClient) queryNotificationsStateHandleResponse(resp *http.Response) (PrivateStoreClientQueryNotificationsStateResponse, error) { - result := PrivateStoreClientQueryNotificationsStateResponse{RawResponse: resp} + result := PrivateStoreClientQueryNotificationsStateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateStoreNotificationsState); err != nil { return PrivateStoreClientQueryNotificationsStateResponse{}, err } @@ -789,7 +1004,7 @@ func (client *PrivateStoreClient) queryOffersCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -797,7 +1012,7 @@ func (client *PrivateStoreClient) queryOffersCreateRequest(ctx context.Context, // queryOffersHandleResponse handles the QueryOffers response. func (client *PrivateStoreClient) queryOffersHandleResponse(resp *http.Response) (PrivateStoreClientQueryOffersResponse, error) { - result := PrivateStoreClientQueryOffersResponse{RawResponse: resp} + result := PrivateStoreClientQueryOffersResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.QueryOffers); err != nil { return PrivateStoreClientQueryOffersResponse{}, err } @@ -841,7 +1056,7 @@ func (client *PrivateStoreClient) queryRequestApprovalCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { @@ -852,7 +1067,7 @@ func (client *PrivateStoreClient) queryRequestApprovalCreateRequest(ctx context. // queryRequestApprovalHandleResponse handles the QueryRequestApproval response. func (client *PrivateStoreClient) queryRequestApprovalHandleResponse(resp *http.Response) (PrivateStoreClientQueryRequestApprovalResponse, error) { - result := PrivateStoreClientQueryRequestApprovalResponse{RawResponse: resp} + result := PrivateStoreClientQueryRequestApprovalResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.QueryRequestApproval); err != nil { return PrivateStoreClientQueryRequestApprovalResponse{}, err } @@ -896,7 +1111,7 @@ func (client *PrivateStoreClient) updateAdminRequestApprovalCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { @@ -907,7 +1122,7 @@ func (client *PrivateStoreClient) updateAdminRequestApprovalCreateRequest(ctx co // updateAdminRequestApprovalHandleResponse handles the UpdateAdminRequestApproval response. func (client *PrivateStoreClient) updateAdminRequestApprovalHandleResponse(resp *http.Response) (PrivateStoreClientUpdateAdminRequestApprovalResponse, error) { - result := PrivateStoreClientUpdateAdminRequestApprovalResponse{RawResponse: resp} + result := PrivateStoreClientUpdateAdminRequestApprovalResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AdminRequestApprovalsResource); err != nil { return PrivateStoreClientUpdateAdminRequestApprovalResponse{}, err } @@ -932,7 +1147,7 @@ func (client *PrivateStoreClient) WithdrawPlan(ctx context.Context, privateStore if !runtime.HasStatusCode(resp, http.StatusOK) { return PrivateStoreClientWithdrawPlanResponse{}, runtime.NewResponseError(resp) } - return PrivateStoreClientWithdrawPlanResponse{RawResponse: resp}, nil + return PrivateStoreClientWithdrawPlanResponse{}, nil } // withdrawPlanCreateRequest creates the WithdrawPlan request. @@ -951,7 +1166,7 @@ func (client *PrivateStoreClient) withdrawPlanCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { diff --git a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_privatestorecollection_client.go b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_privatestorecollection_client.go index 8f10d1c1f420..344b7ecc3ccf 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_privatestorecollection_client.go +++ b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_privatestorecollection_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -31,19 +32,23 @@ type PrivateStoreCollectionClient struct { // NewPrivateStoreCollectionClient creates a new instance of PrivateStoreCollectionClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateStoreCollectionClient(credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateStoreCollectionClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPrivateStoreCollectionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateStoreCollectionClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateStoreCollectionClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Create or update private store collection @@ -83,7 +88,7 @@ func (client *PrivateStoreCollectionClient) createOrUpdateCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { @@ -94,7 +99,7 @@ func (client *PrivateStoreCollectionClient) createOrUpdateCreateRequest(ctx cont // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *PrivateStoreCollectionClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateStoreCollectionClientCreateOrUpdateResponse, error) { - result := PrivateStoreCollectionClientCreateOrUpdateResponse{RawResponse: resp} + result := PrivateStoreCollectionClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Collection); err != nil { return PrivateStoreCollectionClientCreateOrUpdateResponse{}, err } @@ -119,7 +124,7 @@ func (client *PrivateStoreCollectionClient) Delete(ctx context.Context, privateS if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return PrivateStoreCollectionClientDeleteResponse{}, runtime.NewResponseError(resp) } - return PrivateStoreCollectionClientDeleteResponse{RawResponse: resp}, nil + return PrivateStoreCollectionClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -138,7 +143,7 @@ func (client *PrivateStoreCollectionClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -181,7 +186,7 @@ func (client *PrivateStoreCollectionClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -189,7 +194,7 @@ func (client *PrivateStoreCollectionClient) getCreateRequest(ctx context.Context // getHandleResponse handles the Get response. func (client *PrivateStoreCollectionClient) getHandleResponse(resp *http.Response) (PrivateStoreCollectionClientGetResponse, error) { - result := PrivateStoreCollectionClientGetResponse{RawResponse: resp} + result := PrivateStoreCollectionClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Collection); err != nil { return PrivateStoreCollectionClientGetResponse{}, err } @@ -228,7 +233,7 @@ func (client *PrivateStoreCollectionClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +241,7 @@ func (client *PrivateStoreCollectionClient) listCreateRequest(ctx context.Contex // listHandleResponse handles the List response. func (client *PrivateStoreCollectionClient) listHandleResponse(resp *http.Response) (PrivateStoreCollectionClientListResponse, error) { - result := PrivateStoreCollectionClientListResponse{RawResponse: resp} + result := PrivateStoreCollectionClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.CollectionsList); err != nil { return PrivateStoreCollectionClientListResponse{}, err } @@ -261,7 +266,7 @@ func (client *PrivateStoreCollectionClient) Post(ctx context.Context, privateSto if !runtime.HasStatusCode(resp, http.StatusOK) { return PrivateStoreCollectionClientPostResponse{}, runtime.NewResponseError(resp) } - return PrivateStoreCollectionClientPostResponse{RawResponse: resp}, nil + return PrivateStoreCollectionClientPostResponse{}, nil } // postCreateRequest creates the Post request. @@ -280,7 +285,7 @@ func (client *PrivateStoreCollectionClient) postCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { @@ -326,7 +331,7 @@ func (client *PrivateStoreCollectionClient) transferOffersCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { @@ -337,7 +342,7 @@ func (client *PrivateStoreCollectionClient) transferOffersCreateRequest(ctx cont // transferOffersHandleResponse handles the TransferOffers response. func (client *PrivateStoreCollectionClient) transferOffersHandleResponse(resp *http.Response) (PrivateStoreCollectionClientTransferOffersResponse, error) { - result := PrivateStoreCollectionClientTransferOffersResponse{RawResponse: resp} + result := PrivateStoreCollectionClientTransferOffersResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.TransferOffersResponse); err != nil { return PrivateStoreCollectionClientTransferOffersResponse{}, err } diff --git a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_privatestorecollectionoffer_client.go b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_privatestorecollectionoffer_client.go index d27ce10d27c0..41b7eb00f6d4 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_privatestorecollectionoffer_client.go +++ b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_privatestorecollectionoffer_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -31,19 +32,23 @@ type PrivateStoreCollectionOfferClient struct { // NewPrivateStoreCollectionOfferClient creates a new instance of PrivateStoreCollectionOfferClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateStoreCollectionOfferClient(credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateStoreCollectionOfferClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPrivateStoreCollectionOfferClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateStoreCollectionOfferClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateStoreCollectionOfferClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Update or add an offer to a specific collection of the private store. @@ -88,7 +93,7 @@ func (client *PrivateStoreCollectionOfferClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { @@ -99,7 +104,7 @@ func (client *PrivateStoreCollectionOfferClient) createOrUpdateCreateRequest(ctx // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *PrivateStoreCollectionOfferClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateStoreCollectionOfferClientCreateOrUpdateResponse, error) { - result := PrivateStoreCollectionOfferClientCreateOrUpdateResponse{RawResponse: resp} + result := PrivateStoreCollectionOfferClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Offer); err != nil { return PrivateStoreCollectionOfferClientCreateOrUpdateResponse{}, err } @@ -125,7 +130,7 @@ func (client *PrivateStoreCollectionOfferClient) Delete(ctx context.Context, pri if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return PrivateStoreCollectionOfferClientDeleteResponse{}, runtime.NewResponseError(resp) } - return PrivateStoreCollectionOfferClientDeleteResponse{RawResponse: resp}, nil + return PrivateStoreCollectionOfferClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -148,7 +153,7 @@ func (client *PrivateStoreCollectionOfferClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -196,7 +201,7 @@ func (client *PrivateStoreCollectionOfferClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -204,7 +209,7 @@ func (client *PrivateStoreCollectionOfferClient) getCreateRequest(ctx context.Co // getHandleResponse handles the Get response. func (client *PrivateStoreCollectionOfferClient) getHandleResponse(resp *http.Response) (PrivateStoreCollectionOfferClientGetResponse, error) { - result := PrivateStoreCollectionOfferClientGetResponse{RawResponse: resp} + result := PrivateStoreCollectionOfferClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Offer); err != nil { return PrivateStoreCollectionOfferClientGetResponse{}, err } @@ -217,16 +222,32 @@ func (client *PrivateStoreCollectionOfferClient) getHandleResponse(resp *http.Re // collectionID - The collection ID // options - PrivateStoreCollectionOfferClientListOptions contains the optional parameters for the PrivateStoreCollectionOfferClient.List // method. -func (client *PrivateStoreCollectionOfferClient) List(privateStoreID string, collectionID string, options *PrivateStoreCollectionOfferClientListOptions) *PrivateStoreCollectionOfferClientListPager { - return &PrivateStoreCollectionOfferClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, privateStoreID, collectionID, options) +func (client *PrivateStoreCollectionOfferClient) List(privateStoreID string, collectionID string, options *PrivateStoreCollectionOfferClientListOptions) *runtime.Pager[PrivateStoreCollectionOfferClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[PrivateStoreCollectionOfferClientListResponse]{ + More: func(page PrivateStoreCollectionOfferClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp PrivateStoreCollectionOfferClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.OfferListResponse.NextLink) + Fetcher: func(ctx context.Context, page *PrivateStoreCollectionOfferClientListResponse) (PrivateStoreCollectionOfferClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, privateStoreID, collectionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateStoreCollectionOfferClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateStoreCollectionOfferClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateStoreCollectionOfferClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -245,7 +266,7 @@ func (client *PrivateStoreCollectionOfferClient) listCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -253,7 +274,7 @@ func (client *PrivateStoreCollectionOfferClient) listCreateRequest(ctx context.C // listHandleResponse handles the List response. func (client *PrivateStoreCollectionOfferClient) listHandleResponse(resp *http.Response) (PrivateStoreCollectionOfferClientListResponse, error) { - result := PrivateStoreCollectionOfferClientListResponse{RawResponse: resp} + result := PrivateStoreCollectionOfferClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OfferListResponse); err != nil { return PrivateStoreCollectionOfferClientListResponse{}, err } @@ -279,7 +300,7 @@ func (client *PrivateStoreCollectionOfferClient) Post(ctx context.Context, priva if !runtime.HasStatusCode(resp, http.StatusOK) { return PrivateStoreCollectionOfferClientPostResponse{}, runtime.NewResponseError(resp) } - return PrivateStoreCollectionOfferClientPostResponse{RawResponse: resp}, nil + return PrivateStoreCollectionOfferClientPostResponse{}, nil } // postCreateRequest creates the Post request. @@ -302,7 +323,7 @@ func (client *PrivateStoreCollectionOfferClient) postCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Payload != nil { diff --git a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_response_types.go b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_response_types.go index 41084e56c414..41572b435f09 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_response_types.go +++ b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,328 +8,177 @@ package armmarketplace -import "net/http" - // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationListResult } // PrivateStoreClientAcknowledgeOfferNotificationResponse contains the response from method PrivateStoreClient.AcknowledgeOfferNotification. type PrivateStoreClientAcknowledgeOfferNotificationResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PrivateStoreClientAdminRequestApprovalsListResponse contains the response from method PrivateStoreClient.AdminRequestApprovalsList. type PrivateStoreClientAdminRequestApprovalsListResponse struct { - PrivateStoreClientAdminRequestApprovalsListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreClientAdminRequestApprovalsListResult contains the result from method PrivateStoreClient.AdminRequestApprovalsList. -type PrivateStoreClientAdminRequestApprovalsListResult struct { AdminRequestApprovalsList } // PrivateStoreClientBillingAccountsResponse contains the response from method PrivateStoreClient.BillingAccounts. type PrivateStoreClientBillingAccountsResponse struct { - PrivateStoreClientBillingAccountsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreClientBillingAccountsResult contains the result from method PrivateStoreClient.BillingAccounts. -type PrivateStoreClientBillingAccountsResult struct { BillingAccountsResponse } // PrivateStoreClientBulkCollectionsActionResponse contains the response from method PrivateStoreClient.BulkCollectionsAction. type PrivateStoreClientBulkCollectionsActionResponse struct { - PrivateStoreClientBulkCollectionsActionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreClientBulkCollectionsActionResult contains the result from method PrivateStoreClient.BulkCollectionsAction. -type PrivateStoreClientBulkCollectionsActionResult struct { BulkCollectionsResponse } // PrivateStoreClientCollectionsToSubscriptionsMappingResponse contains the response from method PrivateStoreClient.CollectionsToSubscriptionsMapping. type PrivateStoreClientCollectionsToSubscriptionsMappingResponse struct { - PrivateStoreClientCollectionsToSubscriptionsMappingResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreClientCollectionsToSubscriptionsMappingResult contains the result from method PrivateStoreClient.CollectionsToSubscriptionsMapping. -type PrivateStoreClientCollectionsToSubscriptionsMappingResult struct { CollectionsToSubscriptionsMappingResponse } // PrivateStoreClientCreateApprovalRequestResponse contains the response from method PrivateStoreClient.CreateApprovalRequest. type PrivateStoreClientCreateApprovalRequestResponse struct { - PrivateStoreClientCreateApprovalRequestResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreClientCreateApprovalRequestResult contains the result from method PrivateStoreClient.CreateApprovalRequest. -type PrivateStoreClientCreateApprovalRequestResult struct { RequestApprovalResource } // PrivateStoreClientCreateOrUpdateResponse contains the response from method PrivateStoreClient.CreateOrUpdate. type PrivateStoreClientCreateOrUpdateResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PrivateStoreClientDeleteResponse contains the response from method PrivateStoreClient.Delete. type PrivateStoreClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } -// PrivateStoreClientGetAdminRequestApprovalResponse contains the response from method PrivateStoreClient.GetAdminRequestApproval. -type PrivateStoreClientGetAdminRequestApprovalResponse struct { - PrivateStoreClientGetAdminRequestApprovalResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response +// PrivateStoreClientFetchAllSubscriptionsInTenantResponse contains the response from method PrivateStoreClient.FetchAllSubscriptionsInTenant. +type PrivateStoreClientFetchAllSubscriptionsInTenantResponse struct { + SubscriptionsResponse } -// PrivateStoreClientGetAdminRequestApprovalResult contains the result from method PrivateStoreClient.GetAdminRequestApproval. -type PrivateStoreClientGetAdminRequestApprovalResult struct { +// PrivateStoreClientGetAdminRequestApprovalResponse contains the response from method PrivateStoreClient.GetAdminRequestApproval. +type PrivateStoreClientGetAdminRequestApprovalResponse struct { AdminRequestApprovalsResource } // PrivateStoreClientGetApprovalRequestsListResponse contains the response from method PrivateStoreClient.GetApprovalRequestsList. type PrivateStoreClientGetApprovalRequestsListResponse struct { - PrivateStoreClientGetApprovalRequestsListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreClientGetApprovalRequestsListResult contains the result from method PrivateStoreClient.GetApprovalRequestsList. -type PrivateStoreClientGetApprovalRequestsListResult struct { RequestApprovalsList } // PrivateStoreClientGetRequestApprovalResponse contains the response from method PrivateStoreClient.GetRequestApproval. type PrivateStoreClientGetRequestApprovalResponse struct { - PrivateStoreClientGetRequestApprovalResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreClientGetRequestApprovalResult contains the result from method PrivateStoreClient.GetRequestApproval. -type PrivateStoreClientGetRequestApprovalResult struct { RequestApprovalResource } // PrivateStoreClientGetResponse contains the response from method PrivateStoreClient.Get. type PrivateStoreClientGetResponse struct { - PrivateStoreClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + PrivateStore } -// PrivateStoreClientGetResult contains the result from method PrivateStoreClient.Get. -type PrivateStoreClientGetResult struct { - PrivateStore +// PrivateStoreClientListNewPlansNotificationsResponse contains the response from method PrivateStoreClient.ListNewPlansNotifications. +type PrivateStoreClientListNewPlansNotificationsResponse struct { + NewPlansNotificationsList } // PrivateStoreClientListResponse contains the response from method PrivateStoreClient.List. type PrivateStoreClientListResponse struct { - PrivateStoreClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + PrivateStoreList } -// PrivateStoreClientListResult contains the result from method PrivateStoreClient.List. -type PrivateStoreClientListResult struct { - PrivateStoreList +// PrivateStoreClientListStopSellOffersPlansNotificationsResponse contains the response from method PrivateStoreClient.ListStopSellOffersPlansNotifications. +type PrivateStoreClientListStopSellOffersPlansNotificationsResponse struct { + StopSellOffersPlansNotificationsList } -// PrivateStoreClientQueryApprovedPlansResponse contains the response from method PrivateStoreClient.QueryApprovedPlans. -type PrivateStoreClientQueryApprovedPlansResponse struct { - PrivateStoreClientQueryApprovedPlansResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response +// PrivateStoreClientListSubscriptionsContextResponse contains the response from method PrivateStoreClient.ListSubscriptionsContext. +type PrivateStoreClientListSubscriptionsContextResponse struct { + SubscriptionsContextList } -// PrivateStoreClientQueryApprovedPlansResult contains the result from method PrivateStoreClient.QueryApprovedPlans. -type PrivateStoreClientQueryApprovedPlansResult struct { +// PrivateStoreClientQueryApprovedPlansResponse contains the response from method PrivateStoreClient.QueryApprovedPlans. +type PrivateStoreClientQueryApprovedPlansResponse struct { QueryApprovedPlansResponse } // PrivateStoreClientQueryNotificationsStateResponse contains the response from method PrivateStoreClient.QueryNotificationsState. type PrivateStoreClientQueryNotificationsStateResponse struct { - PrivateStoreClientQueryNotificationsStateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreClientQueryNotificationsStateResult contains the result from method PrivateStoreClient.QueryNotificationsState. -type PrivateStoreClientQueryNotificationsStateResult struct { PrivateStoreNotificationsState } // PrivateStoreClientQueryOffersResponse contains the response from method PrivateStoreClient.QueryOffers. type PrivateStoreClientQueryOffersResponse struct { - PrivateStoreClientQueryOffersResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreClientQueryOffersResult contains the result from method PrivateStoreClient.QueryOffers. -type PrivateStoreClientQueryOffersResult struct { QueryOffers } // PrivateStoreClientQueryRequestApprovalResponse contains the response from method PrivateStoreClient.QueryRequestApproval. type PrivateStoreClientQueryRequestApprovalResponse struct { - PrivateStoreClientQueryRequestApprovalResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreClientQueryRequestApprovalResult contains the result from method PrivateStoreClient.QueryRequestApproval. -type PrivateStoreClientQueryRequestApprovalResult struct { QueryRequestApproval } // PrivateStoreClientUpdateAdminRequestApprovalResponse contains the response from method PrivateStoreClient.UpdateAdminRequestApproval. type PrivateStoreClientUpdateAdminRequestApprovalResponse struct { - PrivateStoreClientUpdateAdminRequestApprovalResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreClientUpdateAdminRequestApprovalResult contains the result from method PrivateStoreClient.UpdateAdminRequestApproval. -type PrivateStoreClientUpdateAdminRequestApprovalResult struct { AdminRequestApprovalsResource } // PrivateStoreClientWithdrawPlanResponse contains the response from method PrivateStoreClient.WithdrawPlan. type PrivateStoreClientWithdrawPlanResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PrivateStoreCollectionClientCreateOrUpdateResponse contains the response from method PrivateStoreCollectionClient.CreateOrUpdate. type PrivateStoreCollectionClientCreateOrUpdateResponse struct { - PrivateStoreCollectionClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreCollectionClientCreateOrUpdateResult contains the result from method PrivateStoreCollectionClient.CreateOrUpdate. -type PrivateStoreCollectionClientCreateOrUpdateResult struct { Collection } // PrivateStoreCollectionClientDeleteResponse contains the response from method PrivateStoreCollectionClient.Delete. type PrivateStoreCollectionClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PrivateStoreCollectionClientGetResponse contains the response from method PrivateStoreCollectionClient.Get. type PrivateStoreCollectionClientGetResponse struct { - PrivateStoreCollectionClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreCollectionClientGetResult contains the result from method PrivateStoreCollectionClient.Get. -type PrivateStoreCollectionClientGetResult struct { Collection } // PrivateStoreCollectionClientListResponse contains the response from method PrivateStoreCollectionClient.List. type PrivateStoreCollectionClientListResponse struct { - PrivateStoreCollectionClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreCollectionClientListResult contains the result from method PrivateStoreCollectionClient.List. -type PrivateStoreCollectionClientListResult struct { CollectionsList } // PrivateStoreCollectionClientPostResponse contains the response from method PrivateStoreCollectionClient.Post. type PrivateStoreCollectionClientPostResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PrivateStoreCollectionClientTransferOffersResponse contains the response from method PrivateStoreCollectionClient.TransferOffers. type PrivateStoreCollectionClientTransferOffersResponse struct { - PrivateStoreCollectionClientTransferOffersResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreCollectionClientTransferOffersResult contains the result from method PrivateStoreCollectionClient.TransferOffers. -type PrivateStoreCollectionClientTransferOffersResult struct { TransferOffersResponse } // PrivateStoreCollectionOfferClientCreateOrUpdateResponse contains the response from method PrivateStoreCollectionOfferClient.CreateOrUpdate. type PrivateStoreCollectionOfferClientCreateOrUpdateResponse struct { - PrivateStoreCollectionOfferClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreCollectionOfferClientCreateOrUpdateResult contains the result from method PrivateStoreCollectionOfferClient.CreateOrUpdate. -type PrivateStoreCollectionOfferClientCreateOrUpdateResult struct { Offer } // PrivateStoreCollectionOfferClientDeleteResponse contains the response from method PrivateStoreCollectionOfferClient.Delete. type PrivateStoreCollectionOfferClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PrivateStoreCollectionOfferClientGetResponse contains the response from method PrivateStoreCollectionOfferClient.Get. type PrivateStoreCollectionOfferClientGetResponse struct { - PrivateStoreCollectionOfferClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreCollectionOfferClientGetResult contains the result from method PrivateStoreCollectionOfferClient.Get. -type PrivateStoreCollectionOfferClientGetResult struct { Offer } // PrivateStoreCollectionOfferClientListResponse contains the response from method PrivateStoreCollectionOfferClient.List. type PrivateStoreCollectionOfferClientListResponse struct { - PrivateStoreCollectionOfferClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateStoreCollectionOfferClientListResult contains the result from method PrivateStoreCollectionOfferClient.List. -type PrivateStoreCollectionOfferClientListResult struct { OfferListResponse } // PrivateStoreCollectionOfferClientPostResponse contains the response from method PrivateStoreCollectionOfferClient.Post. type PrivateStoreCollectionOfferClientPostResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } diff --git a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_time_rfc3339.go b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_time_rfc3339.go index f606f309d522..d14ab537eecc 100644 --- a/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/marketplace/armmarketplace/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/CHANGELOG.md b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/CHANGELOG.md index 971ef4c6c92e..64ef80d07bed 100644 --- a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/CHANGELOG.md +++ b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/CHANGELOG.md @@ -1,5 +1,50 @@ # Release History +## 0.3.0 (2022-04-12) +### Breaking Changes + +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `NewMarketplaceAgreementsClient` return value(s) have been changed from `(*MarketplaceAgreementsClient)` to `(*MarketplaceAgreementsClient, error)` +- Function `*OperationsClient.List` return value(s) have been changed from `(*OperationsClientListPager)` to `(*runtime.Pager[OperationsClientListResponse])` +- Function `OfferType.ToPtr` has been removed +- Function `*OperationsClientListPager.PageResponse` has been removed +- Function `CreatedByType.ToPtr` has been removed +- Function `*OperationsClientListPager.Err` has been removed +- Function `*OperationsClientListPager.NextPage` has been removed +- Struct `MarketplaceAgreementsClientCancelResult` has been removed +- Struct `MarketplaceAgreementsClientCreateResult` has been removed +- Struct `MarketplaceAgreementsClientGetAgreementResult` has been removed +- Struct `MarketplaceAgreementsClientGetResult` has been removed +- Struct `MarketplaceAgreementsClientListResult` has been removed +- Struct `MarketplaceAgreementsClientSignResult` has been removed +- Struct `OperationsClientListPager` has been removed +- Struct `OperationsClientListResult` has been removed +- Field `MarketplaceAgreementsClientCancelResult` of struct `MarketplaceAgreementsClientCancelResponse` has been removed +- Field `RawResponse` of struct `MarketplaceAgreementsClientCancelResponse` has been removed +- Field `MarketplaceAgreementsClientCreateResult` of struct `MarketplaceAgreementsClientCreateResponse` has been removed +- Field `RawResponse` of struct `MarketplaceAgreementsClientCreateResponse` has been removed +- Field `MarketplaceAgreementsClientGetAgreementResult` of struct `MarketplaceAgreementsClientGetAgreementResponse` has been removed +- Field `RawResponse` of struct `MarketplaceAgreementsClientGetAgreementResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `MarketplaceAgreementsClientSignResult` of struct `MarketplaceAgreementsClientSignResponse` has been removed +- Field `RawResponse` of struct `MarketplaceAgreementsClientSignResponse` has been removed +- Field `MarketplaceAgreementsClientGetResult` of struct `MarketplaceAgreementsClientGetResponse` has been removed +- Field `RawResponse` of struct `MarketplaceAgreementsClientGetResponse` has been removed +- Field `MarketplaceAgreementsClientListResult` of struct `MarketplaceAgreementsClientListResponse` has been removed +- Field `RawResponse` of struct `MarketplaceAgreementsClientListResponse` has been removed + +### Features Added + +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New anonymous field `AgreementTerms` in struct `MarketplaceAgreementsClientCreateResponse` +- New anonymous field `AgreementTerms` in struct `MarketplaceAgreementsClientGetResponse` +- New anonymous field `AgreementTerms` in struct `MarketplaceAgreementsClientGetAgreementResponse` +- New anonymous field `AgreementTerms` in struct `MarketplaceAgreementsClientSignResponse` +- New anonymous field `AgreementTerms` in struct `MarketplaceAgreementsClientCancelResponse` +- New field `AgreementTermsArray` in struct `MarketplaceAgreementsClientListResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/README.md b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/README.md index fbc8371844a9..195807d7d989 100644 --- a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/README.md +++ b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/README.md @@ -11,7 +11,7 @@ The `armmarketplaceordering` module provides operations for working with Azure M ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Marketplace Ordering 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 -client := armmarketplaceordering.NewMarketplaceAgreementsClient(, cred, nil) +client, err := armmarketplaceordering.NewMarketplaceAgreementsClient(, cred, nil) ``` 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 -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armmarketplaceordering.NewMarketplaceAgreementsClient(, cred, &options) +client, err := armmarketplaceordering.NewMarketplaceAgreementsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/autorest.md b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/autorest.md index afad2a905b54..40c0990895e7 100644 --- a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/autorest.md +++ b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/marketplaceordering/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/marketplaceordering/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/marketplaceordering/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/marketplaceordering/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/go.mod b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/go.mod index 7021d1ce225d..3e4e67ed30ab 100644 --- a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/go.mod +++ b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/marketplaceordering/armmarketplaceordering -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/go.sum b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/go.sum +++ b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm 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/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/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-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/ze_generated_example_marketplaceagreements_client_test.go b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/ze_generated_example_marketplaceagreements_client_test.go index e722179287b8..b39ad33848f5 100644 --- a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/ze_generated_example_marketplaceagreements_client_test.go +++ b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/ze_generated_example_marketplaceagreements_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,128 +19,170 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/marketplaceordering/armmarketplaceordering" ) -// x-ms-original-file: specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/GetMarketplaceTerms.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/GetMarketplaceTerms.json func ExampleMarketplaceAgreementsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplaceordering.NewMarketplaceAgreementsClient("", cred, nil) + client, err := armmarketplaceordering.NewMarketplaceAgreementsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, - armmarketplaceordering.OfferType("virtualmachine"), + armmarketplaceordering.OfferTypeVirtualmachine, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.MarketplaceAgreementsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/SetMarketplaceTerms.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/SetMarketplaceTerms.json func ExampleMarketplaceAgreementsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplaceordering.NewMarketplaceAgreementsClient("", cred, nil) + client, err := armmarketplaceordering.NewMarketplaceAgreementsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Create(ctx, - armmarketplaceordering.OfferType("virtualmachine"), + armmarketplaceordering.OfferTypeVirtualmachine, "", "", "", armmarketplaceordering.AgreementTerms{ Properties: &armmarketplaceordering.AgreementProperties{ - Accepted: to.BoolPtr(false), - LicenseTextLink: to.StringPtr(""), - MarketplaceTermsLink: to.StringPtr(""), - Plan: to.StringPtr(""), - PrivacyPolicyLink: to.StringPtr(""), - Product: to.StringPtr(""), - Publisher: to.StringPtr(""), - RetrieveDatetime: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-15T11:33:07.12132Z"); return t }()), - Signature: to.StringPtr(""), + Accepted: to.Ptr(false), + LicenseTextLink: to.Ptr(""), + MarketplaceTermsLink: to.Ptr(""), + Plan: to.Ptr(""), + PrivacyPolicyLink: to.Ptr(""), + Product: to.Ptr(""), + Publisher: to.Ptr(""), + RetrieveDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-15T11:33:07.12132Z"); return t }()), + Signature: to.Ptr(""), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.MarketplaceAgreementsClientCreateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/SignMarketplaceTerms.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/SignMarketplaceTerms.json func ExampleMarketplaceAgreementsClient_Sign() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplaceordering.NewMarketplaceAgreementsClient("", cred, nil) + client, err := armmarketplaceordering.NewMarketplaceAgreementsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Sign(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.MarketplaceAgreementsClientSignResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/CancelMarketplaceTerms.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/CancelMarketplaceTerms.json func ExampleMarketplaceAgreementsClient_Cancel() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplaceordering.NewMarketplaceAgreementsClient("", cred, nil) + client, err := armmarketplaceordering.NewMarketplaceAgreementsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Cancel(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.MarketplaceAgreementsClientCancelResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/GetAgreementMarketplaceTerms.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/GetAgreementMarketplaceTerms.json func ExampleMarketplaceAgreementsClient_GetAgreement() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplaceordering.NewMarketplaceAgreementsClient("", cred, nil) + client, err := armmarketplaceordering.NewMarketplaceAgreementsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.GetAgreement(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.MarketplaceAgreementsClientGetAgreementResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/ListMarketplaceTerms.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/ListMarketplaceTerms.json func ExampleMarketplaceAgreementsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmarketplaceordering.NewMarketplaceAgreementsClient("", cred, nil) + client, err := armmarketplaceordering.NewMarketplaceAgreementsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.MarketplaceAgreementsClientListResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_constants.go b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_constants.go index 6e54c5cbee05..64d48a67ed0d 100644 --- a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_constants.go +++ b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armmarketplaceordering const ( moduleName = "armmarketplaceordering" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // CreatedByType - The type of identity that created the resource. @@ -33,11 +33,6 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// ToPtr returns a *CreatedByType pointing to the current value. -func (c CreatedByType) ToPtr() *CreatedByType { - return &c -} - type OfferType string const ( @@ -50,8 +45,3 @@ func PossibleOfferTypeValues() []OfferType { OfferTypeVirtualmachine, } } - -// ToPtr returns a *OfferType pointing to the current value. -func (c OfferType) ToPtr() *OfferType { - return &c -} diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_marketplaceagreements_client.go b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_marketplaceagreements_client.go index 58512b239896..ac28f49cc9f1 100644 --- a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_marketplaceagreements_client.go +++ b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_marketplaceagreements_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type MarketplaceAgreementsClient struct { // subscriptionID - The subscription ID that identifies an Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewMarketplaceAgreementsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MarketplaceAgreementsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewMarketplaceAgreementsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MarketplaceAgreementsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &MarketplaceAgreementsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Cancel - Cancel marketplace terms. @@ -103,7 +108,7 @@ func (client *MarketplaceAgreementsClient) cancelCreateRequest(ctx context.Conte // cancelHandleResponse handles the Cancel response. func (client *MarketplaceAgreementsClient) cancelHandleResponse(resp *http.Response) (MarketplaceAgreementsClientCancelResponse, error) { - result := MarketplaceAgreementsClientCancelResponse{RawResponse: resp} + result := MarketplaceAgreementsClientCancelResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AgreementTerms); err != nil { return MarketplaceAgreementsClientCancelResponse{}, err } @@ -170,7 +175,7 @@ func (client *MarketplaceAgreementsClient) createCreateRequest(ctx context.Conte // createHandleResponse handles the Create response. func (client *MarketplaceAgreementsClient) createHandleResponse(resp *http.Response) (MarketplaceAgreementsClientCreateResponse, error) { - result := MarketplaceAgreementsClientCreateResponse{RawResponse: resp} + result := MarketplaceAgreementsClientCreateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AgreementTerms); err != nil { return MarketplaceAgreementsClientCreateResponse{}, err } @@ -236,7 +241,7 @@ func (client *MarketplaceAgreementsClient) getCreateRequest(ctx context.Context, // getHandleResponse handles the Get response. func (client *MarketplaceAgreementsClient) getHandleResponse(resp *http.Response) (MarketplaceAgreementsClientGetResponse, error) { - result := MarketplaceAgreementsClientGetResponse{RawResponse: resp} + result := MarketplaceAgreementsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AgreementTerms); err != nil { return MarketplaceAgreementsClientGetResponse{}, err } @@ -297,7 +302,7 @@ func (client *MarketplaceAgreementsClient) getAgreementCreateRequest(ctx context // getAgreementHandleResponse handles the GetAgreement response. func (client *MarketplaceAgreementsClient) getAgreementHandleResponse(resp *http.Response) (MarketplaceAgreementsClientGetAgreementResponse, error) { - result := MarketplaceAgreementsClientGetAgreementResponse{RawResponse: resp} + result := MarketplaceAgreementsClientGetAgreementResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AgreementTerms); err != nil { return MarketplaceAgreementsClientGetAgreementResponse{}, err } @@ -343,7 +348,7 @@ func (client *MarketplaceAgreementsClient) listCreateRequest(ctx context.Context // listHandleResponse handles the List response. func (client *MarketplaceAgreementsClient) listHandleResponse(resp *http.Response) (MarketplaceAgreementsClientListResponse, error) { - result := MarketplaceAgreementsClientListResponse{RawResponse: resp} + result := MarketplaceAgreementsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AgreementTermsArray); err != nil { return MarketplaceAgreementsClientListResponse{}, err } @@ -404,7 +409,7 @@ func (client *MarketplaceAgreementsClient) signCreateRequest(ctx context.Context // signHandleResponse handles the Sign response. func (client *MarketplaceAgreementsClient) signHandleResponse(resp *http.Response) (MarketplaceAgreementsClientSignResponse, error) { - result := MarketplaceAgreementsClientSignResponse{RawResponse: resp} + result := MarketplaceAgreementsClientSignResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AgreementTerms); err != nil { return MarketplaceAgreementsClientSignResponse{}, err } diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_models.go b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_models.go index f19c9d21391b..99f3f9df4951 100644 --- a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_models.go +++ b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armmarketplaceordering -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // AgreementProperties - Agreement Terms definition type AgreementProperties struct { @@ -45,65 +40,6 @@ type AgreementProperties struct { Signature *string `json:"signature,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AgreementProperties. -func (a AgreementProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accepted", a.Accepted) - populate(objectMap, "licenseTextLink", a.LicenseTextLink) - populate(objectMap, "marketplaceTermsLink", a.MarketplaceTermsLink) - populate(objectMap, "plan", a.Plan) - populate(objectMap, "privacyPolicyLink", a.PrivacyPolicyLink) - populate(objectMap, "product", a.Product) - populate(objectMap, "publisher", a.Publisher) - populateTimeRFC3339(objectMap, "retrieveDatetime", a.RetrieveDatetime) - populate(objectMap, "signature", a.Signature) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AgreementProperties. -func (a *AgreementProperties) 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 "accepted": - err = unpopulate(val, &a.Accepted) - delete(rawMsg, key) - case "licenseTextLink": - err = unpopulate(val, &a.LicenseTextLink) - delete(rawMsg, key) - case "marketplaceTermsLink": - err = unpopulate(val, &a.MarketplaceTermsLink) - delete(rawMsg, key) - case "plan": - err = unpopulate(val, &a.Plan) - delete(rawMsg, key) - case "privacyPolicyLink": - err = unpopulate(val, &a.PrivacyPolicyLink) - delete(rawMsg, key) - case "product": - err = unpopulate(val, &a.Product) - delete(rawMsg, key) - case "publisher": - err = unpopulate(val, &a.Publisher) - delete(rawMsg, key) - case "retrieveDatetime": - err = unpopulateTimeRFC3339(val, &a.RetrieveDatetime) - delete(rawMsg, key) - case "signature": - err = unpopulate(val, &a.Signature) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AgreementTerms - Terms properties for provided Publisher/Offer/Plan tuple type AgreementTerms struct { // Represents the properties of the resource. @@ -203,14 +139,6 @@ type OperationListResult struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -248,67 +176,3 @@ type SystemData struct { // 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 -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_models_serde.go b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_models_serde.go new file mode 100644 index 000000000000..a7cbca03844c --- /dev/null +++ b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_models_serde.go @@ -0,0 +1,146 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmarketplaceordering + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AgreementProperties. +func (a AgreementProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accepted", a.Accepted) + populate(objectMap, "licenseTextLink", a.LicenseTextLink) + populate(objectMap, "marketplaceTermsLink", a.MarketplaceTermsLink) + populate(objectMap, "plan", a.Plan) + populate(objectMap, "privacyPolicyLink", a.PrivacyPolicyLink) + populate(objectMap, "product", a.Product) + populate(objectMap, "publisher", a.Publisher) + populateTimeRFC3339(objectMap, "retrieveDatetime", a.RetrieveDatetime) + populate(objectMap, "signature", a.Signature) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgreementProperties. +func (a *AgreementProperties) 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 "accepted": + err = unpopulate(val, &a.Accepted) + delete(rawMsg, key) + case "licenseTextLink": + err = unpopulate(val, &a.LicenseTextLink) + delete(rawMsg, key) + case "marketplaceTermsLink": + err = unpopulate(val, &a.MarketplaceTermsLink) + delete(rawMsg, key) + case "plan": + err = unpopulate(val, &a.Plan) + delete(rawMsg, key) + case "privacyPolicyLink": + err = unpopulate(val, &a.PrivacyPolicyLink) + delete(rawMsg, key) + case "product": + err = unpopulate(val, &a.Product) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, &a.Publisher) + delete(rawMsg, key) + case "retrieveDatetime": + err = unpopulateTimeRFC3339(val, &a.RetrieveDatetime) + delete(rawMsg, key) + case "signature": + err = unpopulate(val, &a.Signature) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// 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 +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_operations_client.go b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_operations_client.go index d462c86f11ce..4cec66a9499f 100644 --- a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_operations_client.go +++ b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,34 +29,54 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Lists all of the available Microsoft.MarketplaceOrdering REST API operations. // If the operation fails it returns an *azcore.ResponseError type. // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(options *OperationsClientListOptions) *OperationsClientListPager { - return &OperationsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *OperationsClient) List(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp OperationsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationListResult.NextLink) + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -74,7 +95,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_pagers.go b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_pagers.go deleted file mode 100644 index a336374c4bbe..000000000000 --- a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_pagers.go +++ /dev/null @@ -1,71 +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 armmarketplaceordering - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// OperationsClientListPager provides operations for iterating over paged responses. -type OperationsClientListPager struct { - client *OperationsClient - current OperationsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, OperationsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *OperationsClientListPager) 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 *OperationsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.OperationListResult.NextLink == nil || len(*p.current.OperationListResult.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 = runtime.NewResponseError(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 OperationsClientListResponse page. -func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse { - return p.current -} diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_response_types.go b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_response_types.go index 11b3c85c3642..f10932f5a4fa 100644 --- a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_response_types.go +++ b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,89 +8,38 @@ package armmarketplaceordering -import "net/http" - // MarketplaceAgreementsClientCancelResponse contains the response from method MarketplaceAgreementsClient.Cancel. type MarketplaceAgreementsClientCancelResponse struct { - MarketplaceAgreementsClientCancelResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MarketplaceAgreementsClientCancelResult contains the result from method MarketplaceAgreementsClient.Cancel. -type MarketplaceAgreementsClientCancelResult struct { AgreementTerms } // MarketplaceAgreementsClientCreateResponse contains the response from method MarketplaceAgreementsClient.Create. type MarketplaceAgreementsClientCreateResponse struct { - MarketplaceAgreementsClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MarketplaceAgreementsClientCreateResult contains the result from method MarketplaceAgreementsClient.Create. -type MarketplaceAgreementsClientCreateResult struct { AgreementTerms } // MarketplaceAgreementsClientGetAgreementResponse contains the response from method MarketplaceAgreementsClient.GetAgreement. type MarketplaceAgreementsClientGetAgreementResponse struct { - MarketplaceAgreementsClientGetAgreementResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MarketplaceAgreementsClientGetAgreementResult contains the result from method MarketplaceAgreementsClient.GetAgreement. -type MarketplaceAgreementsClientGetAgreementResult struct { AgreementTerms } // MarketplaceAgreementsClientGetResponse contains the response from method MarketplaceAgreementsClient.Get. type MarketplaceAgreementsClientGetResponse struct { - MarketplaceAgreementsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MarketplaceAgreementsClientGetResult contains the result from method MarketplaceAgreementsClient.Get. -type MarketplaceAgreementsClientGetResult struct { AgreementTerms } // MarketplaceAgreementsClientListResponse contains the response from method MarketplaceAgreementsClient.List. type MarketplaceAgreementsClientListResponse struct { - MarketplaceAgreementsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MarketplaceAgreementsClientListResult contains the result from method MarketplaceAgreementsClient.List. -type MarketplaceAgreementsClientListResult struct { // Array of AgreementTerms AgreementTermsArray []*AgreementTerms } // MarketplaceAgreementsClientSignResponse contains the response from method MarketplaceAgreementsClient.Sign. type MarketplaceAgreementsClientSignResponse struct { - MarketplaceAgreementsClientSignResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MarketplaceAgreementsClientSignResult contains the result from method MarketplaceAgreementsClient.Sign. -type MarketplaceAgreementsClientSignResult struct { AgreementTerms } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationListResult } diff --git a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_time_rfc3339.go b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_time_rfc3339.go index d4a7665cc849..ec6280f498ab 100644 --- a/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/marketplaceordering/armmarketplaceordering/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/CHANGELOG.md b/sdk/resourcemanager/mediaservices/armmediaservices/CHANGELOG.md index 48fec519549d..45da12d2e8cd 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/CHANGELOG.md +++ b/sdk/resourcemanager/mediaservices/armmediaservices/CHANGELOG.md @@ -1,5 +1,647 @@ # Release History +## 0.5.0 (2022-04-12) +### Breaking Changes + +- Function `*TransformsClient.List` return value(s) have been changed from `(*TransformsClientListPager)` to `(*runtime.Pager[TransformsClientListResponse])` +- Function `*LiveEventsClient.BeginDelete` return value(s) have been changed from `(LiveEventsClientDeletePollerResponse, error)` to `(*armruntime.Poller[LiveEventsClientDeleteResponse], error)` +- Function `NewStreamingEndpointsClient` return value(s) have been changed from `(*StreamingEndpointsClient)` to `(*StreamingEndpointsClient, error)` +- Function `*StreamingEndpointsClient.BeginDelete` return value(s) have been changed from `(StreamingEndpointsClientDeletePollerResponse, error)` to `(*armruntime.Poller[StreamingEndpointsClientDeleteResponse], error)` +- Function `*StreamingEndpointsClient.BeginCreate` return value(s) have been changed from `(StreamingEndpointsClientCreatePollerResponse, error)` to `(*armruntime.Poller[StreamingEndpointsClientCreateResponse], error)` +- Function `*LiveEventsClient.BeginStop` return value(s) have been changed from `(LiveEventsClientStopPollerResponse, error)` to `(*armruntime.Poller[LiveEventsClientStopResponse], error)` +- Function `*LiveEventsClient.BeginAllocate` return value(s) have been changed from `(LiveEventsClientAllocatePollerResponse, error)` to `(*armruntime.Poller[LiveEventsClientAllocateResponse], error)` +- Function `NewClient` return value(s) have been changed from `(*Client)` to `(*Client, error)` +- Function `NewAssetsClient` return value(s) have been changed from `(*AssetsClient)` to `(*AssetsClient, error)` +- Function `NewTransformsClient` return value(s) have been changed from `(*TransformsClient)` to `(*TransformsClient, error)` +- Function `*LiveOutputsClient.BeginDelete` return value(s) have been changed from `(LiveOutputsClientDeletePollerResponse, error)` to `(*armruntime.Poller[LiveOutputsClientDeleteResponse], error)` +- Function `NewPrivateLinkResourcesClient` return value(s) have been changed from `(*PrivateLinkResourcesClient)` to `(*PrivateLinkResourcesClient, error)` +- Function `NewStreamingPoliciesClient` return value(s) have been changed from `(*StreamingPoliciesClient)` to `(*StreamingPoliciesClient, error)` +- Function `*StreamingEndpointsClient.BeginStart` return value(s) have been changed from `(StreamingEndpointsClientStartPollerResponse, error)` to `(*armruntime.Poller[StreamingEndpointsClientStartResponse], error)` +- Function `*TracksClient.BeginUpdate` return value(s) have been changed from `(TracksClientUpdatePollerResponse, error)` to `(*armruntime.Poller[TracksClientUpdateResponse], error)` +- Function `*StreamingPoliciesClient.List` return value(s) have been changed from `(*StreamingPoliciesClientListPager)` to `(*runtime.Pager[StreamingPoliciesClientListResponse])` +- Function `NewAccountFiltersClient` return value(s) have been changed from `(*AccountFiltersClient)` to `(*AccountFiltersClient, error)` +- Function `*LiveOutputsClient.BeginCreate` return value(s) have been changed from `(LiveOutputsClientCreatePollerResponse, error)` to `(*armruntime.Poller[LiveOutputsClientCreateResponse], error)` +- Function `*StreamingEndpointsClient.BeginUpdate` return value(s) have been changed from `(StreamingEndpointsClientUpdatePollerResponse, error)` to `(*armruntime.Poller[StreamingEndpointsClientUpdateResponse], error)` +- Function `*LiveOutputsClient.List` return value(s) have been changed from `(*LiveOutputsClientListPager)` to `(*runtime.Pager[LiveOutputsClientListResponse])` +- Function `NewJobsClient` return value(s) have been changed from `(*JobsClient)` to `(*JobsClient, error)` +- Function `NewLiveOutputsClient` return value(s) have been changed from `(*LiveOutputsClient)` to `(*LiveOutputsClient, error)` +- Function `*LiveEventsClient.BeginStart` return value(s) have been changed from `(LiveEventsClientStartPollerResponse, error)` to `(*armruntime.Poller[LiveEventsClientStartResponse], error)` +- Function `*StreamingEndpointsClient.BeginScale` return value(s) have been changed from `(StreamingEndpointsClientScalePollerResponse, error)` to `(*armruntime.Poller[StreamingEndpointsClientScaleResponse], error)` +- Function `NewLiveEventsClient` return value(s) have been changed from `(*LiveEventsClient)` to `(*LiveEventsClient, error)` +- Function `*StreamingLocatorsClient.List` return value(s) have been changed from `(*StreamingLocatorsClientListPager)` to `(*runtime.Pager[StreamingLocatorsClientListResponse])` +- Function `*AssetFiltersClient.List` return value(s) have been changed from `(*AssetFiltersClientListPager)` to `(*runtime.Pager[AssetFiltersClientListResponse])` +- Function `*Client.ListBySubscription` return value(s) have been changed from `(*ClientListBySubscriptionPager)` to `(*runtime.Pager[ClientListBySubscriptionResponse])` +- Function `*StreamingEndpointsClient.List` return value(s) have been changed from `(*StreamingEndpointsClientListPager)` to `(*runtime.Pager[StreamingEndpointsClientListResponse])` +- Function `NewTracksClient` return value(s) have been changed from `(*TracksClient)` to `(*TracksClient, error)` +- Function `*TracksClient.BeginDelete` return value(s) have been changed from `(TracksClientDeletePollerResponse, error)` to `(*armruntime.Poller[TracksClientDeleteResponse], error)` +- Function `*LiveEventsClient.BeginUpdate` return value(s) have been changed from `(LiveEventsClientUpdatePollerResponse, error)` to `(*armruntime.Poller[LiveEventsClientUpdateResponse], error)` +- Function `*AssetsClient.List` return value(s) have been changed from `(*AssetsClientListPager)` to `(*runtime.Pager[AssetsClientListResponse])` +- Function `*JobsClient.List` return value(s) have been changed from `(*JobsClientListPager)` to `(*runtime.Pager[JobsClientListResponse])` +- Function `*ContentKeyPoliciesClient.List` return value(s) have been changed from `(*ContentKeyPoliciesClientListPager)` to `(*runtime.Pager[ContentKeyPoliciesClientListResponse])` +- Function `*LiveEventsClient.BeginCreate` return value(s) have been changed from `(LiveEventsClientCreatePollerResponse, error)` to `(*armruntime.Poller[LiveEventsClientCreateResponse], error)` +- Function `NewAssetFiltersClient` return value(s) have been changed from `(*AssetFiltersClient)` to `(*AssetFiltersClient, error)` +- Function `*AccountFiltersClient.List` return value(s) have been changed from `(*AccountFiltersClientListPager)` to `(*runtime.Pager[AccountFiltersClientListResponse])` +- Function `*TracksClient.BeginCreateOrUpdate` return value(s) have been changed from `(TracksClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[TracksClientCreateOrUpdateResponse], error)` +- Function `*TracksClient.BeginUpdateTrackData` return value(s) have been changed from `(TracksClientUpdateTrackDataPollerResponse, error)` to `(*armruntime.Poller[TracksClientUpdateTrackDataResponse], error)` +- Function `NewStreamingLocatorsClient` return value(s) have been changed from `(*StreamingLocatorsClient)` to `(*StreamingLocatorsClient, error)` +- Function `*StreamingEndpointsClient.BeginStop` return value(s) have been changed from `(StreamingEndpointsClientStopPollerResponse, error)` to `(*armruntime.Poller[StreamingEndpointsClientStopResponse], error)` +- Function `*Client.List` return value(s) have been changed from `(*ClientListPager)` to `(*runtime.Pager[ClientListResponse])` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `*TracksClient.List` parameter(s) have been changed from `(context.Context, string, string, string, *TracksClientListOptions)` to `(string, string, string, *TracksClientListOptions)` +- Function `*TracksClient.List` return value(s) have been changed from `(TracksClientListResponse, error)` to `(*runtime.Pager[TracksClientListResponse])` +- Function `NewOperationResultsClient` return value(s) have been changed from `(*OperationResultsClient)` to `(*OperationResultsClient, error)` +- Function `NewLocationsClient` return value(s) have been changed from `(*LocationsClient)` to `(*LocationsClient, error)` +- Function `NewPrivateEndpointConnectionsClient` return value(s) have been changed from `(*PrivateEndpointConnectionsClient)` to `(*PrivateEndpointConnectionsClient, error)` +- Function `*LiveEventsClient.BeginReset` return value(s) have been changed from `(LiveEventsClientResetPollerResponse, error)` to `(*armruntime.Poller[LiveEventsClientResetResponse], error)` +- Function `*LiveEventsClient.List` return value(s) have been changed from `(*LiveEventsClientListPager)` to `(*runtime.Pager[LiveEventsClientListResponse])` +- Function `NewContentKeyPoliciesClient` return value(s) have been changed from `(*ContentKeyPoliciesClient)` to `(*ContentKeyPoliciesClient, error)` +- Function `NewOperationStatusesClient` return value(s) have been changed from `(*OperationStatusesClient)` to `(*OperationStatusesClient, error)` +- Function `JobErrorCategory.ToPtr` has been removed +- Function `*StreamingEndpointsClientCreatePoller.ResumeToken` has been removed +- Function `*TracksClientDeletePoller.FinalResponse` has been removed +- Function `*LiveOutputsClientDeletePollerResponse.Resume` has been removed +- Function `*ClientListBySubscriptionPager.NextPage` has been removed +- Function `LiveEventsClientResetPollerResponse.PollUntilDone` has been removed +- Function `*StreamingEndpointsClientScalePoller.ResumeToken` has been removed +- Function `*LiveOutputsClientListPager.PageResponse` has been removed +- Function `*StreamingPoliciesClientListPager.Err` has been removed +- Function `StreamingLocatorContentKeyType.ToPtr` has been removed +- Function `*LiveEventsClientStartPoller.Done` has been removed +- Function `TracksClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `TrackPropertyType.ToPtr` has been removed +- Function `*StreamingEndpointsClientScalePoller.Done` has been removed +- Function `*LiveEventsClientResetPoller.Done` has been removed +- Function `*TracksClientUpdatePoller.ResumeToken` has been removed +- Function `Rotation.ToPtr` has been removed +- Function `*StreamingPoliciesClientListPager.PageResponse` has been removed +- Function `*ContentKeyPoliciesClientListPager.PageResponse` has been removed +- Function `*LiveEventsClientResetPoller.FinalResponse` has been removed +- Function `*LiveEventsClientDeletePoller.ResumeToken` has been removed +- Function `LiveEventInputProtocol.ToPtr` has been removed +- Function `MetricAggregationType.ToPtr` has been removed +- Function `*LiveEventsClientStopPoller.Done` has been removed +- Function `*LiveEventsClientUpdatePoller.Done` has been removed +- Function `*TracksClientUpdatePoller.Done` has been removed +- Function `*StreamingEndpointsClientUpdatePoller.Poll` has been removed +- Function `*LiveEventsClientAllocatePoller.Done` has been removed +- Function `ContentKeyPolicyPlayReadyUnknownOutputPassingOption.ToPtr` has been removed +- Function `*StreamingEndpointsClientStopPollerResponse.Resume` has been removed +- Function `StreamingEndpointsClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*ClientListBySubscriptionPager.Err` has been removed +- Function `*StreamingEndpointsClientScalePoller.Poll` has been removed +- Function `LiveEventEncodingType.ToPtr` has been removed +- Function `*LiveOutputsClientDeletePoller.FinalResponse` has been removed +- Function `FilterTrackPropertyCompareOperation.ToPtr` has been removed +- Function `*StreamingEndpointsClientStopPoller.FinalResponse` has been removed +- Function `*TracksClientDeletePoller.Done` has been removed +- Function `StreamingEndpointsClientStartPollerResponse.PollUntilDone` has been removed +- Function `*AccountFiltersClientListPager.Err` has been removed +- Function `*LiveEventsClientCreatePoller.ResumeToken` has been removed +- Function `JobRetry.ToPtr` has been removed +- Function `*LiveEventsClientResetPoller.Poll` has been removed +- Function `*StreamingEndpointsClientStartPollerResponse.Resume` has been removed +- Function `*AssetsClientListPager.NextPage` has been removed +- Function `*TransformsClientListPager.Err` has been removed +- Function `*TracksClientDeletePollerResponse.Resume` has been removed +- Function `*LiveEventsClientCreatePoller.FinalResponse` has been removed +- Function `*LiveEventsClientDeletePollerResponse.Resume` has been removed +- Function `TracksClientDeletePollerResponse.PollUntilDone` has been removed +- Function `PrivateEndpointServiceConnectionStatus.ToPtr` has been removed +- Function `*AssetFiltersClientListPager.NextPage` has been removed +- Function `MetricUnit.ToPtr` has been removed +- Function `OnErrorType.ToPtr` has been removed +- Function `PrivateEndpointConnectionProvisioningState.ToPtr` has been removed +- Function `*LiveOutputsClientDeletePoller.Done` has been removed +- Function `LiveEventResourceState.ToPtr` has been removed +- Function `ContentKeyPolicyFairPlayRentalAndLeaseKeyType.ToPtr` has been removed +- Function `*LiveOutputsClientDeletePoller.Poll` has been removed +- Function `StreamingEndpointsClientUpdatePollerResponse.PollUntilDone` has been removed +- Function `*LiveEventsClientStartPoller.Poll` has been removed +- Function `DefaultAction.ToPtr` has been removed +- Function `*AssetFiltersClientListPager.Err` has been removed +- Function `*StreamingEndpointsClientStartPoller.Done` has been removed +- Function `*LiveEventsClientUpdatePoller.ResumeToken` has been removed +- Function `EntropyMode.ToPtr` has been removed +- Function `*StreamingLocatorsClientListPager.Err` has been removed +- Function `*LiveEventsClientResetPoller.ResumeToken` has been removed +- Function `*TracksClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*TracksClientUpdatePoller.Poll` has been removed +- Function `*JobsClientListPager.NextPage` has been removed +- Function `LiveEventsClientAllocatePollerResponse.PollUntilDone` has been removed +- Function `StreamingEndpointsClientScalePollerResponse.PollUntilDone` has been removed +- Function `*StreamingEndpointsClientUpdatePoller.ResumeToken` has been removed +- Function `*ContentKeyPoliciesClientListPager.Err` has been removed +- Function `*TracksClientCreateOrUpdatePoller.Poll` has been removed +- Function `*StreamingEndpointsClientCreatePollerResponse.Resume` has been removed +- Function `StreamingPolicyStreamingProtocol.ToPtr` has been removed +- Function `AssetStorageEncryptionFormat.ToPtr` has been removed +- Function `H264RateControlMode.ToPtr` has been removed +- Function `*StreamingEndpointsClientListPager.PageResponse` has been removed +- Function `TracksClientUpdateTrackDataPollerResponse.PollUntilDone` has been removed +- Function `*StreamingEndpointsClientListPager.NextPage` has been removed +- Function `*LiveEventsClientUpdatePoller.FinalResponse` has been removed +- Function `EncoderNamedPreset.ToPtr` has been removed +- Function `EncryptionScheme.ToPtr` has been removed +- Function `TracksClientUpdatePollerResponse.PollUntilDone` has been removed +- Function `*LiveEventsClientAllocatePollerResponse.Resume` has been removed +- Function `AudioAnalysisMode.ToPtr` has been removed +- Function `LiveEventsClientUpdatePollerResponse.PollUntilDone` has been removed +- Function `*StreamingEndpointsClientDeletePoller.Poll` has been removed +- Function `*StreamingEndpointsClientListPager.Err` has been removed +- Function `*StreamingEndpointsClientDeletePoller.Done` has been removed +- Function `PublicNetworkAccess.ToPtr` has been removed +- Function `StorageAuthentication.ToPtr` has been removed +- Function `*StreamingEndpointsClientCreatePoller.FinalResponse` has been removed +- Function `AccountEncryptionKeyType.ToPtr` has been removed +- Function `DeinterlaceMode.ToPtr` has been removed +- Function `*ClientListPager.NextPage` has been removed +- Function `*LiveEventsClientDeletePoller.Poll` has been removed +- Function `*AccountFiltersClientListPager.NextPage` has been removed +- Function `InterleaveOutput.ToPtr` has been removed +- Function `*AssetFiltersClientListPager.PageResponse` has been removed +- Function `StreamOptionsFlag.ToPtr` has been removed +- Function `*ClientListBySubscriptionPager.PageResponse` has been removed +- Function `*TracksClientUpdatePoller.FinalResponse` has been removed +- Function `*StreamingEndpointsClientStopPoller.Done` has been removed +- Function `*LiveEventsClientAllocatePoller.FinalResponse` has been removed +- Function `H264VideoProfile.ToPtr` has been removed +- Function `*TracksClientUpdateTrackDataPoller.Poll` has been removed +- Function `*ClientListPager.Err` has been removed +- Function `*AssetsClientListPager.Err` has been removed +- Function `*ContentKeyPoliciesClientListPager.NextPage` has been removed +- Function `CreatedByType.ToPtr` has been removed +- Function `*LiveEventsClientStopPoller.FinalResponse` has been removed +- Function `*StreamingEndpointsClientUpdatePoller.Done` has been removed +- Function `*StreamingEndpointsClientUpdatePoller.FinalResponse` has been removed +- Function `*LiveEventsClientCreatePoller.Done` has been removed +- Function `*TracksClientDeletePoller.Poll` has been removed +- Function `DeinterlaceParity.ToPtr` has been removed +- Function `*StreamingEndpointsClientDeletePollerResponse.Resume` has been removed +- Function `*StreamingEndpointsClientStopPoller.ResumeToken` has been removed +- Function `StreamingEndpointsClientCreatePollerResponse.PollUntilDone` has been removed +- Function `*TracksClientDeletePoller.ResumeToken` has been removed +- Function `*LiveEventsClientCreatePollerResponse.Resume` has been removed +- Function `ProvisioningState.ToPtr` has been removed +- Function `*LiveEventsClientStartPoller.FinalResponse` has been removed +- Function `StreamingEndpointResourceState.ToPtr` has been removed +- Function `*StreamingEndpointsClientDeletePoller.ResumeToken` has been removed +- Function `StreamingEndpointsClientStopPollerResponse.PollUntilDone` has been removed +- Function `H265Complexity.ToPtr` has been removed +- Function `ChannelMapping.ToPtr` has been removed +- Function `*LiveOutputsClientCreatePoller.Poll` has been removed +- Function `*LiveEventsClientListPager.PageResponse` has been removed +- Function `*StreamingEndpointsClientCreatePoller.Poll` has been removed +- Function `*LiveEventsClientListPager.NextPage` has been removed +- Function `ContentKeyPolicyRestrictionTokenType.ToPtr` has been removed +- Function `AttributeFilter.ToPtr` has been removed +- Function `BlurType.ToPtr` has been removed +- Function `StretchMode.ToPtr` has been removed +- Function `StorageAccountType.ToPtr` has been removed +- Function `LiveEventsClientStopPollerResponse.PollUntilDone` has been removed +- Function `*TracksClientUpdateTrackDataPoller.ResumeToken` has been removed +- Function `TrackPropertyCompareOperation.ToPtr` has been removed +- Function `*TracksClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*LiveEventsClientStopPollerResponse.Resume` has been removed +- Function `*LiveOutputsClientCreatePoller.FinalResponse` has been removed +- Function `*StreamingLocatorsClientListPager.NextPage` has been removed +- Function `*StreamingEndpointsClientStartPoller.FinalResponse` has been removed +- Function `LiveOutputsClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*LiveEventsClientAllocatePoller.ResumeToken` has been removed +- Function `LiveEventsClientDeletePollerResponse.PollUntilDone` has been removed +- Function `LiveEventsClientStartPollerResponse.PollUntilDone` has been removed +- Function `TrackAttribute.ToPtr` has been removed +- Function `ContentKeyPolicyPlayReadyLicenseType.ToPtr` has been removed +- Function `*StreamingEndpointsClientStopPoller.Poll` has been removed +- Function `FaceRedactorMode.ToPtr` has been removed +- Function `*LiveEventsClientStopPoller.ResumeToken` has been removed +- Function `VideoSyncMode.ToPtr` has been removed +- Function `*LiveEventsClientStartPollerResponse.Resume` has been removed +- Function `ContentKeyPolicyPlayReadyContentType.ToPtr` has been removed +- Function `*StreamingPoliciesClientListPager.NextPage` has been removed +- Function `*StreamingEndpointsClientScalePollerResponse.Resume` has been removed +- Function `JobErrorCode.ToPtr` has been removed +- Function `*JobsClientListPager.PageResponse` has been removed +- Function `*StreamingEndpointsClientStartPoller.ResumeToken` has been removed +- Function `*AssetsClientListPager.PageResponse` has been removed +- Function `*AccountFiltersClientListPager.PageResponse` has been removed +- Function `*TracksClientUpdateTrackDataPoller.FinalResponse` has been removed +- Function `*LiveEventsClientUpdatePoller.Poll` has been removed +- Function `AnalysisResolution.ToPtr` has been removed +- Function `*TracksClientUpdateTrackDataPoller.Done` has been removed +- Function `*LiveOutputsClientListPager.Err` has been removed +- Function `*TracksClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `JobState.ToPtr` has been removed +- Function `*LiveOutputsClientListPager.NextPage` has been removed +- Function `*StreamingEndpointsClientDeletePoller.FinalResponse` has been removed +- Function `FilterTrackPropertyType.ToPtr` has been removed +- Function `*LiveOutputsClientDeletePoller.ResumeToken` has been removed +- Function `ActionType.ToPtr` has been removed +- Function `*TracksClientUpdateTrackDataPollerResponse.Resume` has been removed +- Function `*LiveEventsClientResetPollerResponse.Resume` has been removed +- Function `*TracksClientCreateOrUpdatePoller.Done` has been removed +- Function `*StreamingEndpointsClientScalePoller.FinalResponse` has been removed +- Function `*LiveEventsClientDeletePoller.FinalResponse` has been removed +- Function `*StreamingEndpointsClientUpdatePollerResponse.Resume` has been removed +- Function `AacAudioProfile.ToPtr` has been removed +- Function `Visibility.ToPtr` has been removed +- Function `*LiveEventsClientStopPoller.Poll` has been removed +- Function `*LiveEventsClientAllocatePoller.Poll` has been removed +- Function `*LiveEventsClientDeletePoller.Done` has been removed +- Function `LiveOutputsClientCreatePollerResponse.PollUntilDone` has been removed +- Function `*ClientListPager.PageResponse` has been removed +- Function `H264Complexity.ToPtr` has been removed +- Function `*JobsClientListPager.Err` has been removed +- Function `*LiveEventsClientUpdatePollerResponse.Resume` has been removed +- Function `Priority.ToPtr` has been removed +- Function `*LiveOutputsClientCreatePoller.ResumeToken` has been removed +- Function `*TracksClientUpdatePollerResponse.Resume` has been removed +- Function `AssetContainerPermission.ToPtr` has been removed +- Function `*LiveOutputsClientCreatePollerResponse.Resume` has been removed +- Function `LiveEventsClientCreatePollerResponse.PollUntilDone` has been removed +- Function `*LiveEventsClientCreatePoller.Poll` has been removed +- Function `*LiveEventsClientListPager.Err` has been removed +- Function `H265VideoProfile.ToPtr` has been removed +- Function `*LiveEventsClientStartPoller.ResumeToken` has been removed +- Function `*StreamingLocatorsClientListPager.PageResponse` has been removed +- Function `*StreamingEndpointsClientCreatePoller.Done` has been removed +- Function `*TransformsClientListPager.NextPage` has been removed +- Function `InsightsType.ToPtr` has been removed +- Function `*StreamingEndpointsClientStartPoller.Poll` has been removed +- Function `Complexity.ToPtr` has been removed +- Function `*LiveOutputsClientCreatePoller.Done` has been removed +- Function `LiveOutputResourceState.ToPtr` has been removed +- Function `*TransformsClientListPager.PageResponse` has been removed +- Struct `AccountFiltersClientCreateOrUpdateResult` has been removed +- Struct `AccountFiltersClientGetResult` has been removed +- Struct `AccountFiltersClientListPager` has been removed +- Struct `AccountFiltersClientListResult` has been removed +- Struct `AccountFiltersClientUpdateResult` has been removed +- Struct `AssetFiltersClientCreateOrUpdateResult` has been removed +- Struct `AssetFiltersClientGetResult` has been removed +- Struct `AssetFiltersClientListPager` has been removed +- Struct `AssetFiltersClientListResult` has been removed +- Struct `AssetFiltersClientUpdateResult` has been removed +- Struct `AssetsClientCreateOrUpdateResult` has been removed +- Struct `AssetsClientGetEncryptionKeyResult` has been removed +- Struct `AssetsClientGetResult` has been removed +- Struct `AssetsClientListContainerSasResult` has been removed +- Struct `AssetsClientListPager` has been removed +- Struct `AssetsClientListResult` has been removed +- Struct `AssetsClientListStreamingLocatorsResult` has been removed +- Struct `AssetsClientUpdateResult` has been removed +- Struct `ClientCreateOrUpdateResult` has been removed +- Struct `ClientGetResult` has been removed +- Struct `ClientListBySubscriptionPager` has been removed +- Struct `ClientListBySubscriptionResult` has been removed +- Struct `ClientListEdgePoliciesResult` has been removed +- Struct `ClientListPager` has been removed +- Struct `ClientListResult` has been removed +- Struct `ClientUpdateResult` has been removed +- Struct `ContentKeyPoliciesClientCreateOrUpdateResult` has been removed +- Struct `ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResult` has been removed +- Struct `ContentKeyPoliciesClientGetResult` has been removed +- Struct `ContentKeyPoliciesClientListPager` has been removed +- Struct `ContentKeyPoliciesClientListResult` has been removed +- Struct `ContentKeyPoliciesClientUpdateResult` has been removed +- Struct `JobsClientCreateResult` has been removed +- Struct `JobsClientGetResult` has been removed +- Struct `JobsClientListPager` has been removed +- Struct `JobsClientListResult` has been removed +- Struct `JobsClientUpdateResult` has been removed +- Struct `LiveEventsClientAllocatePoller` has been removed +- Struct `LiveEventsClientAllocatePollerResponse` has been removed +- Struct `LiveEventsClientCreatePoller` has been removed +- Struct `LiveEventsClientCreatePollerResponse` has been removed +- Struct `LiveEventsClientCreateResult` has been removed +- Struct `LiveEventsClientDeletePoller` has been removed +- Struct `LiveEventsClientDeletePollerResponse` has been removed +- Struct `LiveEventsClientGetResult` has been removed +- Struct `LiveEventsClientListPager` has been removed +- Struct `LiveEventsClientListResult` has been removed +- Struct `LiveEventsClientResetPoller` has been removed +- Struct `LiveEventsClientResetPollerResponse` has been removed +- Struct `LiveEventsClientStartPoller` has been removed +- Struct `LiveEventsClientStartPollerResponse` has been removed +- Struct `LiveEventsClientStopPoller` has been removed +- Struct `LiveEventsClientStopPollerResponse` has been removed +- Struct `LiveEventsClientUpdatePoller` has been removed +- Struct `LiveEventsClientUpdatePollerResponse` has been removed +- Struct `LiveEventsClientUpdateResult` has been removed +- Struct `LiveOutputsClientCreatePoller` has been removed +- Struct `LiveOutputsClientCreatePollerResponse` has been removed +- Struct `LiveOutputsClientCreateResult` has been removed +- Struct `LiveOutputsClientDeletePoller` has been removed +- Struct `LiveOutputsClientDeletePollerResponse` has been removed +- Struct `LiveOutputsClientGetResult` has been removed +- Struct `LiveOutputsClientListPager` has been removed +- Struct `LiveOutputsClientListResult` has been removed +- Struct `LocationsClientCheckNameAvailabilityResult` has been removed +- Struct `OperationResultsClientGetResult` has been removed +- Struct `OperationStatusesClientGetResult` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `PrivateEndpointConnectionsClientCreateOrUpdateResult` has been removed +- Struct `PrivateEndpointConnectionsClientGetResult` has been removed +- Struct `PrivateEndpointConnectionsClientListResult` has been removed +- Struct `PrivateLinkResourcesClientGetResult` has been removed +- Struct `PrivateLinkResourcesClientListResult` has been removed +- Struct `StreamingEndpointsClientCreatePoller` has been removed +- Struct `StreamingEndpointsClientCreatePollerResponse` has been removed +- Struct `StreamingEndpointsClientCreateResult` has been removed +- Struct `StreamingEndpointsClientDeletePoller` has been removed +- Struct `StreamingEndpointsClientDeletePollerResponse` has been removed +- Struct `StreamingEndpointsClientGetResult` has been removed +- Struct `StreamingEndpointsClientListPager` has been removed +- Struct `StreamingEndpointsClientListResult` has been removed +- Struct `StreamingEndpointsClientSKUsResult` has been removed +- Struct `StreamingEndpointsClientScalePoller` has been removed +- Struct `StreamingEndpointsClientScalePollerResponse` has been removed +- Struct `StreamingEndpointsClientStartPoller` has been removed +- Struct `StreamingEndpointsClientStartPollerResponse` has been removed +- Struct `StreamingEndpointsClientStopPoller` has been removed +- Struct `StreamingEndpointsClientStopPollerResponse` has been removed +- Struct `StreamingEndpointsClientUpdatePoller` has been removed +- Struct `StreamingEndpointsClientUpdatePollerResponse` has been removed +- Struct `StreamingEndpointsClientUpdateResult` has been removed +- Struct `StreamingLocatorsClientCreateResult` has been removed +- Struct `StreamingLocatorsClientGetResult` has been removed +- Struct `StreamingLocatorsClientListContentKeysResult` has been removed +- Struct `StreamingLocatorsClientListPager` has been removed +- Struct `StreamingLocatorsClientListPathsResult` has been removed +- Struct `StreamingLocatorsClientListResult` has been removed +- Struct `StreamingPoliciesClientCreateResult` has been removed +- Struct `StreamingPoliciesClientGetResult` has been removed +- Struct `StreamingPoliciesClientListPager` has been removed +- Struct `StreamingPoliciesClientListResult` has been removed +- Struct `TracksClientCreateOrUpdatePoller` has been removed +- Struct `TracksClientCreateOrUpdatePollerResponse` has been removed +- Struct `TracksClientCreateOrUpdateResult` has been removed +- Struct `TracksClientDeletePoller` has been removed +- Struct `TracksClientDeletePollerResponse` has been removed +- Struct `TracksClientGetResult` has been removed +- Struct `TracksClientListResult` has been removed +- Struct `TracksClientUpdatePoller` has been removed +- Struct `TracksClientUpdatePollerResponse` has been removed +- Struct `TracksClientUpdateResult` has been removed +- Struct `TracksClientUpdateTrackDataPoller` has been removed +- Struct `TracksClientUpdateTrackDataPollerResponse` has been removed +- Struct `TransformsClientCreateOrUpdateResult` has been removed +- Struct `TransformsClientGetResult` has been removed +- Struct `TransformsClientListPager` has been removed +- Struct `TransformsClientListResult` has been removed +- Struct `TransformsClientUpdateResult` has been removed +- Field `AssetFiltersClientUpdateResult` of struct `AssetFiltersClientUpdateResponse` has been removed +- Field `RawResponse` of struct `AssetFiltersClientUpdateResponse` has been removed +- Field `AssetsClientGetEncryptionKeyResult` of struct `AssetsClientGetEncryptionKeyResponse` has been removed +- Field `RawResponse` of struct `AssetsClientGetEncryptionKeyResponse` has been removed +- Field `RawResponse` of struct `LiveEventsClientStartResponse` has been removed +- Field `LocationsClientCheckNameAvailabilityResult` of struct `LocationsClientCheckNameAvailabilityResponse` has been removed +- Field `RawResponse` of struct `LocationsClientCheckNameAvailabilityResponse` has been removed +- Field `ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResult` of struct `ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResponse` has been removed +- Field `RawResponse` of struct `ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResponse` has been removed +- Field `PrivateEndpointConnectionsClientListResult` of struct `PrivateEndpointConnectionsClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientListResponse` has been removed +- Field `RawResponse` of struct `JobsClientDeleteResponse` has been removed +- Field `StreamingLocatorsClientGetResult` of struct `StreamingLocatorsClientGetResponse` has been removed +- Field `RawResponse` of struct `StreamingLocatorsClientGetResponse` has been removed +- Field `TracksClientUpdateResult` of struct `TracksClientUpdateResponse` has been removed +- Field `RawResponse` of struct `TracksClientUpdateResponse` has been removed +- Field `ClientListEdgePoliciesResult` of struct `ClientListEdgePoliciesResponse` has been removed +- Field `RawResponse` of struct `ClientListEdgePoliciesResponse` has been removed +- Field `LiveEventsClientListResult` of struct `LiveEventsClientListResponse` has been removed +- Field `RawResponse` of struct `LiveEventsClientListResponse` has been removed +- Field `StreamingLocatorsClientCreateResult` of struct `StreamingLocatorsClientCreateResponse` has been removed +- Field `RawResponse` of struct `StreamingLocatorsClientCreateResponse` has been removed +- Field `OperationStatusesClientGetResult` of struct `OperationStatusesClientGetResponse` has been removed +- Field `RawResponse` of struct `OperationStatusesClientGetResponse` has been removed +- Field `RawResponse` of struct `StreamingEndpointsClientDeleteResponse` has been removed +- Field `AssetsClientListStreamingLocatorsResult` of struct `AssetsClientListStreamingLocatorsResponse` has been removed +- Field `RawResponse` of struct `AssetsClientListStreamingLocatorsResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `PrivateLinkResourcesClientGetResult` of struct `PrivateLinkResourcesClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateLinkResourcesClientGetResponse` has been removed +- Field `ContentKeyPoliciesClientCreateOrUpdateResult` of struct `ContentKeyPoliciesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ContentKeyPoliciesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ClientSyncStorageKeysResponse` has been removed +- Field `ContentKeyPoliciesClientGetResult` of struct `ContentKeyPoliciesClientGetResponse` has been removed +- Field `RawResponse` of struct `ContentKeyPoliciesClientGetResponse` has been removed +- Field `AssetsClientListResult` of struct `AssetsClientListResponse` has been removed +- Field `RawResponse` of struct `AssetsClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientDeleteResponse` has been removed +- Field `OperationResultsClientGetResult` of struct `OperationResultsClientGetResponse` has been removed +- Field `RawResponse` of struct `OperationResultsClientGetResponse` has been removed +- Field `RawResponse` of struct `AssetsClientDeleteResponse` has been removed +- Field `ContentKeyPoliciesClientListResult` of struct `ContentKeyPoliciesClientListResponse` has been removed +- Field `RawResponse` of struct `ContentKeyPoliciesClientListResponse` has been removed +- Field `RawResponse` of struct `AccountFiltersClientDeleteResponse` has been removed +- Field `StreamingPoliciesClientListResult` of struct `StreamingPoliciesClientListResponse` has been removed +- Field `RawResponse` of struct `StreamingPoliciesClientListResponse` has been removed +- Field `RawResponse` of struct `LiveEventsClientStopResponse` has been removed +- Field `StreamingEndpointsClientGetResult` of struct `StreamingEndpointsClientGetResponse` has been removed +- Field `RawResponse` of struct `StreamingEndpointsClientGetResponse` has been removed +- Field `RawResponse` of struct `StreamingLocatorsClientDeleteResponse` has been removed +- Field `JobsClientUpdateResult` of struct `JobsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `JobsClientUpdateResponse` has been removed +- Field `LiveOutputsClientGetResult` of struct `LiveOutputsClientGetResponse` has been removed +- Field `RawResponse` of struct `LiveOutputsClientGetResponse` has been removed +- Field `ClientListResult` of struct `ClientListResponse` has been removed +- Field `RawResponse` of struct `ClientListResponse` has been removed +- Field `AssetFiltersClientListResult` of struct `AssetFiltersClientListResponse` has been removed +- Field `RawResponse` of struct `AssetFiltersClientListResponse` has been removed +- Field `LiveOutputsClientCreateResult` of struct `LiveOutputsClientCreateResponse` has been removed +- Field `RawResponse` of struct `LiveOutputsClientCreateResponse` has been removed +- Field `RawResponse` of struct `TransformsClientDeleteResponse` has been removed +- Field `LiveEventsClientGetResult` of struct `LiveEventsClientGetResponse` has been removed +- Field `RawResponse` of struct `LiveEventsClientGetResponse` has been removed +- Field `TransformsClientGetResult` of struct `TransformsClientGetResponse` has been removed +- Field `RawResponse` of struct `TransformsClientGetResponse` has been removed +- Field `ClientListBySubscriptionResult` of struct `ClientListBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `ClientListBySubscriptionResponse` has been removed +- Field `StreamingLocatorsClientListContentKeysResult` of struct `StreamingLocatorsClientListContentKeysResponse` has been removed +- Field `RawResponse` of struct `StreamingLocatorsClientListContentKeysResponse` has been removed +- Field `RawResponse` of struct `ContentKeyPoliciesClientDeleteResponse` has been removed +- Field `JobsClientListResult` of struct `JobsClientListResponse` has been removed +- Field `RawResponse` of struct `JobsClientListResponse` has been removed +- Field `TransformsClientCreateOrUpdateResult` of struct `TransformsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `TransformsClientCreateOrUpdateResponse` has been removed +- Field `LiveEventsClientUpdateResult` of struct `LiveEventsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `LiveEventsClientUpdateResponse` has been removed +- Field `TracksClientGetResult` of struct `TracksClientGetResponse` has been removed +- Field `RawResponse` of struct `TracksClientGetResponse` has been removed +- Field `RawResponse` of struct `LiveEventsClientResetResponse` has been removed +- Field `StreamingPoliciesClientCreateResult` of struct `StreamingPoliciesClientCreateResponse` has been removed +- Field `RawResponse` of struct `StreamingPoliciesClientCreateResponse` has been removed +- Field `TracksClientListResult` of struct `TracksClientListResponse` has been removed +- Field `RawResponse` of struct `TracksClientListResponse` has been removed +- Field `StreamingLocatorsClientListPathsResult` of struct `StreamingLocatorsClientListPathsResponse` has been removed +- Field `RawResponse` of struct `StreamingLocatorsClientListPathsResponse` has been removed +- Field `ClientGetResult` of struct `ClientGetResponse` has been removed +- Field `RawResponse` of struct `ClientGetResponse` has been removed +- Field `AccountFiltersClientCreateOrUpdateResult` of struct `AccountFiltersClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `AccountFiltersClientCreateOrUpdateResponse` has been removed +- Field `StreamingLocatorsClientListResult` of struct `StreamingLocatorsClientListResponse` has been removed +- Field `RawResponse` of struct `StreamingLocatorsClientListResponse` has been removed +- Field `PrivateEndpointConnectionsClientCreateOrUpdateResult` of struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` has been removed +- Field `StreamingEndpointsClientCreateResult` of struct `StreamingEndpointsClientCreateResponse` has been removed +- Field `RawResponse` of struct `StreamingEndpointsClientCreateResponse` has been removed +- Field `TransformsClientListResult` of struct `TransformsClientListResponse` has been removed +- Field `RawResponse` of struct `TransformsClientListResponse` has been removed +- Field `JobsClientCreateResult` of struct `JobsClientCreateResponse` has been removed +- Field `RawResponse` of struct `JobsClientCreateResponse` has been removed +- Field `RawResponse` of struct `TracksClientDeleteResponse` has been removed +- Field `ClientCreateOrUpdateResult` of struct `ClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ClientCreateOrUpdateResponse` has been removed +- Field `PrivateLinkResourcesClientListResult` of struct `PrivateLinkResourcesClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateLinkResourcesClientListResponse` has been removed +- Field `ContentKeyPoliciesClientUpdateResult` of struct `ContentKeyPoliciesClientUpdateResponse` has been removed +- Field `RawResponse` of struct `ContentKeyPoliciesClientUpdateResponse` has been removed +- Field `AssetFiltersClientCreateOrUpdateResult` of struct `AssetFiltersClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `AssetFiltersClientCreateOrUpdateResponse` has been removed +- Field `AssetsClientGetResult` of struct `AssetsClientGetResponse` has been removed +- Field `RawResponse` of struct `AssetsClientGetResponse` has been removed +- Field `RawResponse` of struct `StreamingEndpointsClientScaleResponse` has been removed +- Field `StreamingEndpointsClientUpdateResult` of struct `StreamingEndpointsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `StreamingEndpointsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `LiveEventsClientAllocateResponse` has been removed +- Field `StreamingPoliciesClientGetResult` of struct `StreamingPoliciesClientGetResponse` has been removed +- Field `RawResponse` of struct `StreamingPoliciesClientGetResponse` has been removed +- Field `AccountFiltersClientGetResult` of struct `AccountFiltersClientGetResponse` has been removed +- Field `RawResponse` of struct `AccountFiltersClientGetResponse` has been removed +- Field `JobsClientGetResult` of struct `JobsClientGetResponse` has been removed +- Field `RawResponse` of struct `JobsClientGetResponse` has been removed +- Field `LiveOutputsClientListResult` of struct `LiveOutputsClientListResponse` has been removed +- Field `RawResponse` of struct `LiveOutputsClientListResponse` has been removed +- Field `AssetFiltersClientGetResult` of struct `AssetFiltersClientGetResponse` has been removed +- Field `RawResponse` of struct `AssetFiltersClientGetResponse` has been removed +- Field `RawResponse` of struct `TracksClientUpdateTrackDataResponse` has been removed +- Field `RawResponse` of struct `StreamingEndpointsClientStopResponse` has been removed +- Field `TransformsClientUpdateResult` of struct `TransformsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `TransformsClientUpdateResponse` has been removed +- Field `LiveEventsClientCreateResult` of struct `LiveEventsClientCreateResponse` has been removed +- Field `RawResponse` of struct `LiveEventsClientCreateResponse` has been removed +- Field `StreamingEndpointsClientListResult` of struct `StreamingEndpointsClientListResponse` has been removed +- Field `RawResponse` of struct `StreamingEndpointsClientListResponse` has been removed +- Field `ClientUpdateResult` of struct `ClientUpdateResponse` has been removed +- Field `RawResponse` of struct `ClientUpdateResponse` has been removed +- Field `RawResponse` of struct `StreamingEndpointsClientStartResponse` has been removed +- Field `RawResponse` of struct `StreamingPoliciesClientDeleteResponse` has been removed +- Field `RawResponse` of struct `JobsClientCancelJobResponse` has been removed +- Field `AssetsClientUpdateResult` of struct `AssetsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `AssetsClientUpdateResponse` has been removed +- Field `AssetsClientCreateOrUpdateResult` of struct `AssetsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `AssetsClientCreateOrUpdateResponse` has been removed +- Field `AssetsClientListContainerSasResult` of struct `AssetsClientListContainerSasResponse` has been removed +- Field `RawResponse` of struct `AssetsClientListContainerSasResponse` has been removed +- Field `PrivateEndpointConnectionsClientGetResult` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `RawResponse` of struct `LiveEventsClientDeleteResponse` has been removed +- Field `TracksClientCreateOrUpdateResult` of struct `TracksClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `TracksClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `AssetFiltersClientDeleteResponse` has been removed +- Field `AccountFiltersClientListResult` of struct `AccountFiltersClientListResponse` has been removed +- Field `RawResponse` of struct `AccountFiltersClientListResponse` has been removed +- Field `AccountFiltersClientUpdateResult` of struct `AccountFiltersClientUpdateResponse` has been removed +- Field `RawResponse` of struct `AccountFiltersClientUpdateResponse` has been removed +- Field `StreamingEndpointsClientSKUsResult` of struct `StreamingEndpointsClientSKUsResponse` has been removed +- Field `RawResponse` of struct `StreamingEndpointsClientSKUsResponse` has been removed +- Field `RawResponse` of struct `LiveOutputsClientDeleteResponse` has been removed +- Field `RawResponse` of struct `ClientDeleteResponse` has been removed + +### Features Added + +- New struct `ErrorResponse` +- New anonymous field `LiveOutput` in struct `LiveOutputsClientGetResponse` +- New anonymous field `AssetFilter` in struct `AssetFiltersClientCreateOrUpdateResponse` +- New field `ResumeToken` in struct `StreamingEndpointsClientBeginCreateOptions` +- New anonymous field `StreamingPolicyCollection` in struct `StreamingPoliciesClientListResponse` +- New anonymous field `AssetTrack` in struct `OperationResultsClientGetResponse` +- New field `AzureAsyncOperation` in struct `OperationResultsClientGetResponse` +- New field `Location` in struct `OperationResultsClientGetResponse` +- New field `RetryAfter` in struct `OperationResultsClientGetResponse` +- New anonymous field `MediaServiceCollection` in struct `ClientListResponse` +- New anonymous field `ListStreamingLocatorsResponse` in struct `AssetsClientListStreamingLocatorsResponse` +- New anonymous field `MediaService` in struct `ClientGetResponse` +- New anonymous field `StreamingLocator` in struct `StreamingLocatorsClientGetResponse` +- New field `ResumeToken` in struct `LiveEventsClientBeginCreateOptions` +- New anonymous field `StreamingEndpoint` in struct `StreamingEndpointsClientCreateResponse` +- New field `ResumeToken` in struct `StreamingEndpointsClientBeginUpdateOptions` +- New field `ResumeToken` in struct `LiveOutputsClientBeginDeleteOptions` +- New field `ResumeToken` in struct `LiveEventsClientBeginStartOptions` +- New field `ResumeToken` in struct `TracksClientBeginUpdateOptions` +- New anonymous field `ContentKeyPolicyCollection` in struct `ContentKeyPoliciesClientListResponse` +- New anonymous field `StreamingPolicy` in struct `StreamingPoliciesClientGetResponse` +- New anonymous field `AccountFilter` in struct `AccountFiltersClientCreateOrUpdateResponse` +- New anonymous field `MediaServiceCollection` in struct `ClientListBySubscriptionResponse` +- New anonymous field `ListPathsResponse` in struct `StreamingLocatorsClientListPathsResponse` +- New anonymous field `ListContentKeysResponse` in struct `StreamingLocatorsClientListContentKeysResponse` +- New anonymous field `PrivateEndpointConnectionListResult` in struct `PrivateEndpointConnectionsClientListResponse` +- New anonymous field `LiveEvent` in struct `LiveEventsClientUpdateResponse` +- New anonymous field `StreamingEndpointListResult` in struct `StreamingEndpointsClientListResponse` +- New anonymous field `EntityNameAvailabilityCheckOutput` in struct `LocationsClientCheckNameAvailabilityResponse` +- New anonymous field `StreamingEndpoint` in struct `StreamingEndpointsClientUpdateResponse` +- New field `ResumeToken` in struct `LiveEventsClientBeginStopOptions` +- New anonymous field `StreamingLocator` in struct `StreamingLocatorsClientCreateResponse` +- New anonymous field `StreamingLocatorCollection` in struct `StreamingLocatorsClientListResponse` +- New anonymous field `LiveEventListResult` in struct `LiveEventsClientListResponse` +- New anonymous field `LiveEvent` in struct `LiveEventsClientGetResponse` +- New field `ResumeToken` in struct `LiveEventsClientBeginUpdateOptions` +- New field `ResumeToken` in struct `StreamingEndpointsClientBeginScaleOptions` +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsClientGetResponse` +- New anonymous field `StreamingEndpoint` in struct `StreamingEndpointsClientGetResponse` +- New anonymous field `ContentKeyPolicy` in struct `ContentKeyPoliciesClientCreateOrUpdateResponse` +- New anonymous field `AssetCollection` in struct `AssetsClientListResponse` +- New anonymous field `AssetFilter` in struct `AssetFiltersClientUpdateResponse` +- New anonymous field `StorageEncryptedAssetDecryptionData` in struct `AssetsClientGetEncryptionKeyResponse` +- New anonymous field `MediaService` in struct `ClientUpdateResponse` +- New field `ResumeToken` in struct `TracksClientBeginDeleteOptions` +- New anonymous field `ContentKeyPolicyProperties` in struct `ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResponse` +- New field `ResumeToken` in struct `LiveEventsClientBeginResetOptions` +- New anonymous field `OperationCollection` in struct `OperationsClientListResponse` +- New anonymous field `PrivateLinkResourceListResult` in struct `PrivateLinkResourcesClientListResponse` +- New field `ResumeToken` in struct `StreamingEndpointsClientBeginStartOptions` +- New field `ResumeToken` in struct `LiveOutputsClientBeginCreateOptions` +- New anonymous field `StreamingEndpointSKUInfoListResult` in struct `StreamingEndpointsClientSKUsResponse` +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` +- New anonymous field `LiveOutput` in struct `LiveOutputsClientCreateResponse` +- New field `ResumeToken` in struct `LiveEventsClientBeginDeleteOptions` +- New anonymous field `PrivateLinkResource` in struct `PrivateLinkResourcesClientGetResponse` +- New anonymous field `MediaService` in struct `ClientCreateOrUpdateResponse` +- New anonymous field `LiveEvent` in struct `LiveEventsClientCreateResponse` +- New field `ResumeToken` in struct `StreamingEndpointsClientBeginStopOptions` +- New anonymous field `LiveOutputListResult` in struct `LiveOutputsClientListResponse` +- New anonymous field `AccountFilter` in struct `AccountFiltersClientUpdateResponse` +- New anonymous field `AssetTrack` in struct `TracksClientGetResponse` +- New anonymous field `Transform` in struct `TransformsClientCreateOrUpdateResponse` +- New anonymous field `AccountFilterCollection` in struct `AccountFiltersClientListResponse` +- New anonymous field `TransformCollection` in struct `TransformsClientListResponse` +- New anonymous field `AssetContainerSas` in struct `AssetsClientListContainerSasResponse` +- New field `ResumeToken` in struct `TracksClientBeginCreateOrUpdateOptions` +- New anonymous field `AssetTrack` in struct `TracksClientUpdateResponse` +- New field `ResumeToken` in struct `StreamingEndpointsClientBeginDeleteOptions` +- New field `ResumeToken` in struct `LiveEventsClientBeginAllocateOptions` +- New anonymous field `Asset` in struct `AssetsClientUpdateResponse` +- New anonymous field `JobCollection` in struct `JobsClientListResponse` +- New anonymous field `Job` in struct `JobsClientGetResponse` +- New anonymous field `Transform` in struct `TransformsClientUpdateResponse` +- New anonymous field `AssetTrackCollection` in struct `TracksClientListResponse` +- New anonymous field `Job` in struct `JobsClientUpdateResponse` +- New anonymous field `ContentKeyPolicy` in struct `ContentKeyPoliciesClientUpdateResponse` +- New anonymous field `EdgePolicies` in struct `ClientListEdgePoliciesResponse` +- New anonymous field `StreamingPolicy` in struct `StreamingPoliciesClientCreateResponse` +- New anonymous field `Job` in struct `JobsClientCreateResponse` +- New anonymous field `AssetFilterCollection` in struct `AssetFiltersClientListResponse` +- New anonymous field `AssetFilter` in struct `AssetFiltersClientGetResponse` +- New anonymous field `Transform` in struct `TransformsClientGetResponse` +- New anonymous field `Asset` in struct `AssetsClientGetResponse` +- New anonymous field `Asset` in struct `AssetsClientCreateOrUpdateResponse` +- New anonymous field `AssetTrackOperationStatus` in struct `OperationStatusesClientGetResponse` +- New anonymous field `ContentKeyPolicy` in struct `ContentKeyPoliciesClientGetResponse` +- New anonymous field `AssetTrack` in struct `TracksClientCreateOrUpdateResponse` +- New anonymous field `AccountFilter` in struct `AccountFiltersClientGetResponse` +- New field `ResumeToken` in struct `TracksClientBeginUpdateTrackDataOptions` + + ## 0.4.0 (2022-04-04) ### Breaking Changes diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/README.md b/sdk/resourcemanager/mediaservices/armmediaservices/README.md index 02d6c480989c..42f8aab5f6c9 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/README.md +++ b/sdk/resourcemanager/mediaservices/armmediaservices/README.md @@ -11,7 +11,7 @@ The `armmediaservices` module provides operations for working with Azure Media S ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden 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 -client := armmediaservices.NewMediaservicesClient(, cred, nil) +client, err := armmediaservices.NewMediaservicesClient(, cred, nil) ``` 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 -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armmediaservices.NewMediaservicesClient(, cred, &options) +client, err := armmediaservices.NewMediaservicesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/autorest.md b/sdk/resourcemanager/mediaservices/armmediaservices/autorest.md index 184f4d324a27..d220f56e151b 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/a1a224b54f05debfa94fd19477ed820c64f0f9fc/specification/mediaservices/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/a1a224b54f05debfa94fd19477ed820c64f0f9fc/specification/mediaservices/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/mediaservices/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/845321c7088aa9b1aa2d715b87aa0d052e2ca976/specification/mediaservices/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.4.0 +module-version: 0.5.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/go.mod b/sdk/resourcemanager/mediaservices/armmediaservices/go.mod index 45309c02d61f..b656c32c14b9 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/go.mod +++ b/sdk/resourcemanager/mediaservices/armmediaservices/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.2 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/go.sum b/sdk/resourcemanager/mediaservices/armmediaservices/go.sum index cdae84f012f3..56d1c32628ae 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/go.sum +++ b/sdk/resourcemanager/mediaservices/armmediaservices/go.sum @@ -1,21 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.2 h1:mM/yraAumqMMIYev6zX0oxHqX6hreUs5wXf76W47r38= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.2/go.mod h1:+nVKciyKD2J9TyVcEQ82Bo9b+3F92PiQfHrIE/zqLqM= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -35,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm 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/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/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-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -59,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_accountfilters_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_accountfilters_client_test.go index 6e87a4a88455..973c57cf9281 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_accountfilters_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_accountfilters_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,58 +17,74 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/accountFilters-list-all.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/accountFilters-list-all.json func ExampleAccountFiltersClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAccountFiltersClient("", cred, nil) + client, err := armmediaservices.NewAccountFiltersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/accountFilters-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/accountFilters-get-by-name.json func ExampleAccountFiltersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAccountFiltersClient("", cred, nil) + client, err := armmediaservices.NewAccountFiltersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountFiltersClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/accountFilters-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/accountFilters-create.json func ExampleAccountFiltersClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAccountFiltersClient("", cred, nil) + client, err := armmediaservices.NewAccountFiltersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", @@ -76,83 +92,96 @@ func ExampleAccountFiltersClient_CreateOrUpdate() { armmediaservices.AccountFilter{ Properties: &armmediaservices.MediaFilterProperties{ FirstQuality: &armmediaservices.FirstQuality{ - Bitrate: to.Int32Ptr(128000), + Bitrate: to.Ptr[int32](128000), }, PresentationTimeRange: &armmediaservices.PresentationTimeRange{ - EndTimestamp: to.Int64Ptr(170000000), - ForceEndTimestamp: to.BoolPtr(false), - LiveBackoffDuration: to.Int64Ptr(0), - PresentationWindowDuration: to.Int64Ptr(9223372036854775000), - StartTimestamp: to.Int64Ptr(0), - Timescale: to.Int64Ptr(10000000), + EndTimestamp: to.Ptr[int64](170000000), + ForceEndTimestamp: to.Ptr(false), + LiveBackoffDuration: to.Ptr[int64](0), + PresentationWindowDuration: to.Ptr[int64](9223372036854775000), + StartTimestamp: to.Ptr[int64](0), + Timescale: to.Ptr[int64](10000000), }, Tracks: []*armmediaservices.FilterTrackSelection{ { TrackSelections: []*armmediaservices.FilterTrackPropertyCondition{ { - Operation: armmediaservices.FilterTrackPropertyCompareOperation("Equal").ToPtr(), - Property: armmediaservices.FilterTrackPropertyType("Type").ToPtr(), - Value: to.StringPtr(""), + Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationEqual), + Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeType), + Value: to.Ptr(""), }, { - Operation: armmediaservices.FilterTrackPropertyCompareOperation("NotEqual").ToPtr(), - Property: armmediaservices.FilterTrackPropertyType("Language").ToPtr(), - Value: to.StringPtr(""), + Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationNotEqual), + Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeLanguage), + Value: to.Ptr(""), }, { - Operation: armmediaservices.FilterTrackPropertyCompareOperation("NotEqual").ToPtr(), - Property: armmediaservices.FilterTrackPropertyType("FourCC").ToPtr(), - Value: to.StringPtr(""), + Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationNotEqual), + Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeFourCC), + Value: to.Ptr(""), }}, }, { TrackSelections: []*armmediaservices.FilterTrackPropertyCondition{ { - Operation: armmediaservices.FilterTrackPropertyCompareOperation("Equal").ToPtr(), - Property: armmediaservices.FilterTrackPropertyType("Type").ToPtr(), - Value: to.StringPtr(""), + Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationEqual), + Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeType), + Value: to.Ptr(""), }, { - Operation: armmediaservices.FilterTrackPropertyCompareOperation("Equal").ToPtr(), - Property: armmediaservices.FilterTrackPropertyType("Bitrate").ToPtr(), - Value: to.StringPtr(""), + Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationEqual), + Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeBitrate), + Value: to.Ptr(""), }}, }}, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountFiltersClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/accountFilters-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/accountFilters-delete.json func ExampleAccountFiltersClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAccountFiltersClient("", cred, nil) + client, err := armmediaservices.NewAccountFiltersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/accountFilters-update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/accountFilters-update.json func ExampleAccountFiltersClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAccountFiltersClient("", cred, nil) + client, err := armmediaservices.NewAccountFiltersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", @@ -160,21 +189,23 @@ func ExampleAccountFiltersClient_Update() { armmediaservices.AccountFilter{ Properties: &armmediaservices.MediaFilterProperties{ FirstQuality: &armmediaservices.FirstQuality{ - Bitrate: to.Int32Ptr(128000), + Bitrate: to.Ptr[int32](128000), }, PresentationTimeRange: &armmediaservices.PresentationTimeRange{ - EndTimestamp: to.Int64Ptr(170000000), - ForceEndTimestamp: to.BoolPtr(false), - LiveBackoffDuration: to.Int64Ptr(0), - PresentationWindowDuration: to.Int64Ptr(9223372036854775000), - StartTimestamp: to.Int64Ptr(10), - Timescale: to.Int64Ptr(10000000), + EndTimestamp: to.Ptr[int64](170000000), + ForceEndTimestamp: to.Ptr(false), + LiveBackoffDuration: to.Ptr[int64](0), + PresentationWindowDuration: to.Ptr[int64](9223372036854775000), + StartTimestamp: to.Ptr[int64](10), + Timescale: to.Ptr[int64](10000000), }, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountFiltersClientUpdateResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_assetfilters_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_assetfilters_client_test.go index ff228723fd53..8879ef9d6df2 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_assetfilters_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_assetfilters_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,40 +17,49 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assetFilters-list-all.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assetFilters-list-all.json func ExampleAssetFiltersClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAssetFiltersClient("", cred, nil) + client, err := armmediaservices.NewAssetFiltersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assetFilters-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assetFilters-get-by-name.json func ExampleAssetFiltersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAssetFiltersClient("", cred, nil) + client, err := armmediaservices.NewAssetFiltersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", @@ -58,19 +67,26 @@ func ExampleAssetFiltersClient_Get() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AssetFiltersClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assetFilters-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assetFilters-create.json func ExampleAssetFiltersClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAssetFiltersClient("", cred, nil) + client, err := armmediaservices.NewAssetFiltersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", @@ -79,65 +95,72 @@ func ExampleAssetFiltersClient_CreateOrUpdate() { armmediaservices.AssetFilter{ Properties: &armmediaservices.MediaFilterProperties{ FirstQuality: &armmediaservices.FirstQuality{ - Bitrate: to.Int32Ptr(128000), + Bitrate: to.Ptr[int32](128000), }, PresentationTimeRange: &armmediaservices.PresentationTimeRange{ - EndTimestamp: to.Int64Ptr(170000000), - ForceEndTimestamp: to.BoolPtr(false), - LiveBackoffDuration: to.Int64Ptr(0), - PresentationWindowDuration: to.Int64Ptr(9223372036854775000), - StartTimestamp: to.Int64Ptr(0), - Timescale: to.Int64Ptr(10000000), + EndTimestamp: to.Ptr[int64](170000000), + ForceEndTimestamp: to.Ptr(false), + LiveBackoffDuration: to.Ptr[int64](0), + PresentationWindowDuration: to.Ptr[int64](9223372036854775000), + StartTimestamp: to.Ptr[int64](0), + Timescale: to.Ptr[int64](10000000), }, Tracks: []*armmediaservices.FilterTrackSelection{ { TrackSelections: []*armmediaservices.FilterTrackPropertyCondition{ { - Operation: armmediaservices.FilterTrackPropertyCompareOperation("Equal").ToPtr(), - Property: armmediaservices.FilterTrackPropertyType("Type").ToPtr(), - Value: to.StringPtr(""), + Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationEqual), + Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeType), + Value: to.Ptr(""), }, { - Operation: armmediaservices.FilterTrackPropertyCompareOperation("NotEqual").ToPtr(), - Property: armmediaservices.FilterTrackPropertyType("Language").ToPtr(), - Value: to.StringPtr(""), + Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationNotEqual), + Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeLanguage), + Value: to.Ptr(""), }, { - Operation: armmediaservices.FilterTrackPropertyCompareOperation("NotEqual").ToPtr(), - Property: armmediaservices.FilterTrackPropertyType("FourCC").ToPtr(), - Value: to.StringPtr(""), + Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationNotEqual), + Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeFourCC), + Value: to.Ptr(""), }}, }, { TrackSelections: []*armmediaservices.FilterTrackPropertyCondition{ { - Operation: armmediaservices.FilterTrackPropertyCompareOperation("Equal").ToPtr(), - Property: armmediaservices.FilterTrackPropertyType("Type").ToPtr(), - Value: to.StringPtr(""), + Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationEqual), + Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeType), + Value: to.Ptr(""), }, { - Operation: armmediaservices.FilterTrackPropertyCompareOperation("Equal").ToPtr(), - Property: armmediaservices.FilterTrackPropertyType("Bitrate").ToPtr(), - Value: to.StringPtr(""), + Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationEqual), + Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeBitrate), + Value: to.Ptr(""), }}, }}, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AssetFiltersClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assetFilters-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assetFilters-delete.json func ExampleAssetFiltersClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAssetFiltersClient("", cred, nil) + client, err := armmediaservices.NewAssetFiltersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", @@ -145,18 +168,24 @@ func ExampleAssetFiltersClient_Delete() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assetFilters-update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assetFilters-update.json func ExampleAssetFiltersClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAssetFiltersClient("", cred, nil) + client, err := armmediaservices.NewAssetFiltersClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", @@ -165,21 +194,23 @@ func ExampleAssetFiltersClient_Update() { armmediaservices.AssetFilter{ Properties: &armmediaservices.MediaFilterProperties{ FirstQuality: &armmediaservices.FirstQuality{ - Bitrate: to.Int32Ptr(128000), + Bitrate: to.Ptr[int32](128000), }, PresentationTimeRange: &armmediaservices.PresentationTimeRange{ - EndTimestamp: to.Int64Ptr(170000000), - ForceEndTimestamp: to.BoolPtr(false), - LiveBackoffDuration: to.Int64Ptr(0), - PresentationWindowDuration: to.Int64Ptr(9223372036854775000), - StartTimestamp: to.Int64Ptr(10), - Timescale: to.Int64Ptr(10000000), + EndTimestamp: to.Ptr[int64](170000000), + ForceEndTimestamp: to.Ptr(false), + LiveBackoffDuration: to.Ptr[int64](0), + PresentationWindowDuration: to.Ptr[int64](9223372036854775000), + StartTimestamp: to.Ptr[int64](10), + Timescale: to.Ptr[int64](10000000), }, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AssetFiltersClientUpdateResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_assets_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_assets_client_test.go index 641aa532c947..2307097f5637 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_assets_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_assets_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,177 +19,229 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-list-in-date-range.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-list-in-date-range.json func ExampleAssetsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAssetsClient("", cred, nil) + client, err := armmediaservices.NewAssetsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", - &armmediaservices.AssetsClientListOptions{Filter: to.StringPtr(""), + &armmediaservices.AssetsClientListOptions{Filter: to.Ptr(""), Top: nil, - Orderby: to.StringPtr(""), + Orderby: to.Ptr(""), }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-get-by-name.json func ExampleAssetsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAssetsClient("", cred, nil) + client, err := armmediaservices.NewAssetsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AssetsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-create.json func ExampleAssetsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAssetsClient("", cred, nil) + client, err := armmediaservices.NewAssetsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", "", armmediaservices.Asset{ Properties: &armmediaservices.AssetProperties{ - Description: to.StringPtr(""), - StorageAccountName: to.StringPtr(""), + Description: to.Ptr(""), + StorageAccountName: to.Ptr(""), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AssetsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-delete.json func ExampleAssetsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAssetsClient("", cred, nil) + client, err := armmediaservices.NewAssetsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-update.json func ExampleAssetsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAssetsClient("", cred, nil) + client, err := armmediaservices.NewAssetsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", "", armmediaservices.Asset{ Properties: &armmediaservices.AssetProperties{ - Description: to.StringPtr(""), + Description: to.Ptr(""), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AssetsClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-list-sas-urls.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-list-sas-urls.json func ExampleAssetsClient_ListContainerSas() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAssetsClient("", cred, nil) + client, err := armmediaservices.NewAssetsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListContainerSas(ctx, "", "", "", armmediaservices.ListContainerSasInput{ - ExpiryTime: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T10:00:00.007Z"); return t }()), - Permissions: armmediaservices.AssetContainerPermission("ReadWrite").ToPtr(), + ExpiryTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T10:00:00.007Z"); return t }()), + Permissions: to.Ptr(armmediaservices.AssetContainerPermissionReadWrite), }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AssetsClientListContainerSasResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-get-encryption-keys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-get-encryption-keys.json func ExampleAssetsClient_GetEncryptionKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAssetsClient("", cred, nil) + client, err := armmediaservices.NewAssetsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.GetEncryptionKey(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AssetsClientGetEncryptionKeyResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-list-streaming-locators.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/assets-list-streaming-locators.json func ExampleAssetsClient_ListStreamingLocators() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewAssetsClient("", cred, nil) + client, err := armmediaservices.NewAssetsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListStreamingLocators(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AssetsClientListStreamingLocatorsResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_contentkeypolicies_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_contentkeypolicies_client_test.go index c4aacb90a90d..b5cfbc3bd6ec 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_contentkeypolicies_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_contentkeypolicies_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,161 +17,199 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/content-key-policies-list-by-lastModified.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/content-key-policies-list-by-lastModified.json func ExampleContentKeyPoliciesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewContentKeyPoliciesClient("", cred, nil) + client, err := armmediaservices.NewContentKeyPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", &armmediaservices.ContentKeyPoliciesClientListOptions{Filter: nil, Top: nil, - Orderby: to.StringPtr(""), + Orderby: to.Ptr(""), }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/content-key-policies-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/content-key-policies-get-by-name.json func ExampleContentKeyPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewContentKeyPoliciesClient("", cred, nil) + client, err := armmediaservices.NewContentKeyPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ContentKeyPoliciesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/content-key-policies-create-nodrm-token.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/content-key-policies-create-nodrm-token.json func ExampleContentKeyPoliciesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewContentKeyPoliciesClient("", cred, nil) + client, err := armmediaservices.NewContentKeyPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", "", armmediaservices.ContentKeyPolicy{ Properties: &armmediaservices.ContentKeyPolicyProperties{ - Description: to.StringPtr(""), + Description: to.Ptr(""), Options: []*armmediaservices.ContentKeyPolicyOption{ { - Name: to.StringPtr(""), + Name: to.Ptr(""), Configuration: &armmediaservices.ContentKeyPolicyClearKeyConfiguration{ - ODataType: to.StringPtr(""), + ODataType: to.Ptr(""), }, Restriction: &armmediaservices.ContentKeyPolicyTokenRestriction{ - ODataType: to.StringPtr(""), - Audience: to.StringPtr(""), - Issuer: to.StringPtr(""), + ODataType: to.Ptr(""), + Audience: to.Ptr(""), + Issuer: to.Ptr(""), PrimaryVerificationKey: &armmediaservices.ContentKeyPolicySymmetricTokenKey{ - ODataType: to.StringPtr(""), + ODataType: to.Ptr(""), KeyValue: []byte("AAAAAAAAAAAAAAAAAAAAAA=="), }, - RestrictionTokenType: armmediaservices.ContentKeyPolicyRestrictionTokenType("Swt").ToPtr(), + RestrictionTokenType: to.Ptr(armmediaservices.ContentKeyPolicyRestrictionTokenTypeSwt), }, }}, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ContentKeyPoliciesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/content-key-policies-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/content-key-policies-delete.json func ExampleContentKeyPoliciesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewContentKeyPoliciesClient("", cred, nil) + client, err := armmediaservices.NewContentKeyPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/content-key-policies-update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/content-key-policies-update.json func ExampleContentKeyPoliciesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewContentKeyPoliciesClient("", cred, nil) + client, err := armmediaservices.NewContentKeyPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", "", armmediaservices.ContentKeyPolicy{ Properties: &armmediaservices.ContentKeyPolicyProperties{ - Description: to.StringPtr(""), + Description: to.Ptr(""), Options: []*armmediaservices.ContentKeyPolicyOption{ { - Name: to.StringPtr(""), + Name: to.Ptr(""), Configuration: &armmediaservices.ContentKeyPolicyClearKeyConfiguration{ - ODataType: to.StringPtr(""), + ODataType: to.Ptr(""), }, Restriction: &armmediaservices.ContentKeyPolicyOpenRestriction{ - ODataType: to.StringPtr(""), + ODataType: to.Ptr(""), }, }}, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ContentKeyPoliciesClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/content-key-policies-get-with-secrets.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/content-key-policies-get-with-secrets.json func ExampleContentKeyPoliciesClient_GetPolicyPropertiesWithSecrets() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewContentKeyPoliciesClient("", cred, nil) + client, err := armmediaservices.NewContentKeyPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.GetPolicyPropertiesWithSecrets(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_jobs_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_jobs_client_test.go index 47e54c60060c..0245edf2a8b7 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_jobs_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_jobs_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,42 +17,51 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/jobs-list-all-filter-by-created.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/jobs-list-all-filter-by-created.json func ExampleJobsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewJobsClient("", cred, nil) + client, err := armmediaservices.NewJobsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", "", - &armmediaservices.JobsClientListOptions{Filter: to.StringPtr(""), - Orderby: to.StringPtr(""), + &armmediaservices.JobsClientListOptions{Filter: to.Ptr(""), + Orderby: to.Ptr(""), }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/jobs-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/jobs-get-by-name.json func ExampleJobsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewJobsClient("", cred, nil) + client, err := armmediaservices.NewJobsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", @@ -60,19 +69,26 @@ func ExampleJobsClient_Get() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.JobsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/jobs-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/jobs-create.json func ExampleJobsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewJobsClient("", cred, nil) + client, err := armmediaservices.NewJobsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Create(ctx, "", "", @@ -81,34 +97,40 @@ func ExampleJobsClient_Create() { armmediaservices.Job{ Properties: &armmediaservices.JobProperties{ CorrelationData: map[string]*string{ - "Key 2": to.StringPtr("Value 2"), - "key1": to.StringPtr("value1"), + "Key 2": to.Ptr("Value 2"), + "key1": to.Ptr("value1"), }, Input: &armmediaservices.JobInputAsset{ - ODataType: to.StringPtr(""), - AssetName: to.StringPtr(""), + ODataType: to.Ptr(""), + AssetName: to.Ptr(""), }, Outputs: []armmediaservices.JobOutputClassification{ &armmediaservices.JobOutputAsset{ - ODataType: to.StringPtr(""), - AssetName: to.StringPtr(""), + ODataType: to.Ptr(""), + AssetName: to.Ptr(""), }}, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/jobs-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/jobs-delete.json func ExampleJobsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewJobsClient("", cred, nil) + client, err := armmediaservices.NewJobsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", @@ -116,18 +138,24 @@ func ExampleJobsClient_Delete() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/jobs-update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/jobs-update.json func ExampleJobsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewJobsClient("", cred, nil) + client, err := armmediaservices.NewJobsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", @@ -135,34 +163,41 @@ func ExampleJobsClient_Update() { "", armmediaservices.Job{ Properties: &armmediaservices.JobProperties{ - Description: to.StringPtr(""), + Description: to.Ptr(""), Input: &armmediaservices.JobInputAsset{ - ODataType: to.StringPtr(""), - AssetName: to.StringPtr(""), + ODataType: to.Ptr(""), + AssetName: to.Ptr(""), }, Outputs: []armmediaservices.JobOutputClassification{ &armmediaservices.JobOutputAsset{ - ODataType: to.StringPtr(""), - AssetName: to.StringPtr(""), + ODataType: to.Ptr(""), + AssetName: to.Ptr(""), }}, - Priority: armmediaservices.Priority("High").ToPtr(), + Priority: to.Ptr(armmediaservices.PriorityHigh), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.JobsClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/jobs-cancel.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/jobs-cancel.json func ExampleJobsClient_CancelJob() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewJobsClient("", cred, nil) + client, err := armmediaservices.NewJobsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.CancelJob(ctx, "", "", @@ -170,6 +205,7 @@ func ExampleJobsClient_CancelJob() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_liveevents_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_liveevents_client_test.go index d2dfda00a423..7e1222543886 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_liveevents_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_liveevents_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,276 +19,340 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-list-all.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-list-all.json func ExampleLiveEventsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLiveEventsClient("", cred, nil) + client, err := armmediaservices.NewLiveEventsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-list-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-list-by-name.json func ExampleLiveEventsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLiveEventsClient("", cred, nil) + client, err := armmediaservices.NewLiveEventsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.LiveEventsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-create.json func ExampleLiveEventsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLiveEventsClient("", cred, nil) + client, err := armmediaservices.NewLiveEventsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreate(ctx, "", "", "", armmediaservices.LiveEvent{ - Location: to.StringPtr(""), + Location: to.Ptr(""), Tags: map[string]*string{ - "tag1": to.StringPtr("value1"), - "tag2": to.StringPtr("value2"), + "tag1": to.Ptr("value1"), + "tag2": to.Ptr("value2"), }, Properties: &armmediaservices.LiveEventProperties{ - Description: to.StringPtr(""), + Description: to.Ptr(""), Input: &armmediaservices.LiveEventInput{ AccessControl: &armmediaservices.LiveEventInputAccessControl{ IP: &armmediaservices.IPAccessControl{ Allow: []*armmediaservices.IPRange{ { - Name: to.StringPtr(""), - Address: to.StringPtr("
"), - SubnetPrefixLength: to.Int32Ptr(0), + Name: to.Ptr(""), + Address: to.Ptr("
"), + SubnetPrefixLength: to.Ptr[int32](0), }}, }, }, - KeyFrameIntervalDuration: to.StringPtr(""), - StreamingProtocol: armmediaservices.LiveEventInputProtocol("RTMP").ToPtr(), + KeyFrameIntervalDuration: to.Ptr(""), + StreamingProtocol: to.Ptr(armmediaservices.LiveEventInputProtocolRTMP), }, Preview: &armmediaservices.LiveEventPreview{ AccessControl: &armmediaservices.LiveEventPreviewAccessControl{ IP: &armmediaservices.IPAccessControl{ Allow: []*armmediaservices.IPRange{ { - Name: to.StringPtr(""), - Address: to.StringPtr("
"), - SubnetPrefixLength: to.Int32Ptr(0), + Name: to.Ptr(""), + Address: to.Ptr("
"), + SubnetPrefixLength: to.Ptr[int32](0), }}, }, }, }, }, }, - &armmediaservices.LiveEventsClientBeginCreateOptions{AutoStart: nil}) + &armmediaservices.LiveEventsClientBeginCreateOptions{AutoStart: nil, + ResumeToken: "", + }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.LiveEventsClientCreateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-update.json func ExampleLiveEventsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLiveEventsClient("", cred, nil) + client, err := armmediaservices.NewLiveEventsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginUpdate(ctx, "", "", "", armmediaservices.LiveEvent{ - Location: to.StringPtr(""), + Location: to.Ptr(""), Tags: map[string]*string{ - "tag1": to.StringPtr("value1"), - "tag2": to.StringPtr("value2"), - "tag3": to.StringPtr("value3"), + "tag1": to.Ptr("value1"), + "tag2": to.Ptr("value2"), + "tag3": to.Ptr("value3"), }, Properties: &armmediaservices.LiveEventProperties{ - Description: to.StringPtr(""), + Description: to.Ptr(""), Input: &armmediaservices.LiveEventInput{ AccessControl: &armmediaservices.LiveEventInputAccessControl{ IP: &armmediaservices.IPAccessControl{ Allow: []*armmediaservices.IPRange{ { - Name: to.StringPtr(""), - Address: to.StringPtr("
"), + Name: to.Ptr(""), + Address: to.Ptr("
"), }}, }, }, - KeyFrameIntervalDuration: to.StringPtr(""), - StreamingProtocol: armmediaservices.LiveEventInputProtocol("FragmentedMP4").ToPtr(), + KeyFrameIntervalDuration: to.Ptr(""), + StreamingProtocol: to.Ptr(armmediaservices.LiveEventInputProtocolFragmentedMP4), }, Preview: &armmediaservices.LiveEventPreview{ AccessControl: &armmediaservices.LiveEventPreviewAccessControl{ IP: &armmediaservices.IPAccessControl{ Allow: []*armmediaservices.IPRange{ { - Name: to.StringPtr(""), - Address: to.StringPtr("
"), + Name: to.Ptr(""), + Address: to.Ptr("
"), }}, }, }, }, }, }, - nil) + &armmediaservices.LiveEventsClientBeginUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.LiveEventsClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-delete.json func ExampleLiveEventsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLiveEventsClient("", cred, nil) + client, err := armmediaservices.NewLiveEventsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "", "", "", - nil) + &armmediaservices.LiveEventsClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-allocate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-allocate.json func ExampleLiveEventsClient_BeginAllocate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLiveEventsClient("", cred, nil) + client, err := armmediaservices.NewLiveEventsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginAllocate(ctx, "", "", "", - nil) + &armmediaservices.LiveEventsClientBeginAllocateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-start.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-start.json func ExampleLiveEventsClient_BeginStart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLiveEventsClient("", cred, nil) + client, err := armmediaservices.NewLiveEventsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginStart(ctx, "", "", "", - nil) + &armmediaservices.LiveEventsClientBeginStartOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-stop.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-stop.json func ExampleLiveEventsClient_BeginStop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLiveEventsClient("", cred, nil) + client, err := armmediaservices.NewLiveEventsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginStop(ctx, "", "", "", armmediaservices.LiveEventActionInput{ - RemoveOutputsOnStop: to.BoolPtr(false), + RemoveOutputsOnStop: to.Ptr(false), }, - nil) + &armmediaservices.LiveEventsClientBeginStopOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-reset.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveevent-reset.json func ExampleLiveEventsClient_BeginReset() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLiveEventsClient("", cred, nil) + client, err := armmediaservices.NewLiveEventsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginReset(ctx, "", "", "", - nil) + &armmediaservices.LiveEventsClientBeginResetOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_liveoutputs_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_liveoutputs_client_test.go index b2d6806b961c..efc0d9167200 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_liveoutputs_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_liveoutputs_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,40 +19,49 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveoutput-list-all.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveoutput-list-all.json func ExampleLiveOutputsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLiveOutputsClient("", cred, nil) + client, err := armmediaservices.NewLiveOutputsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveoutput-list-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveoutput-list-by-name.json func ExampleLiveOutputsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLiveOutputsClient("", cred, nil) + client, err := armmediaservices.NewLiveOutputsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", @@ -60,19 +69,26 @@ func ExampleLiveOutputsClient_Get() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.LiveOutputsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveoutput-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveoutput-create.json func ExampleLiveOutputsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLiveOutputsClient("", cred, nil) + client, err := armmediaservices.NewLiveOutputsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreate(ctx, "", "", @@ -80,45 +96,55 @@ func ExampleLiveOutputsClient_BeginCreate() { "", armmediaservices.LiveOutput{ Properties: &armmediaservices.LiveOutputProperties{ - Description: to.StringPtr(""), - ArchiveWindowLength: to.StringPtr(""), - AssetName: to.StringPtr(""), + Description: to.Ptr(""), + ArchiveWindowLength: to.Ptr(""), + AssetName: to.Ptr(""), Hls: &armmediaservices.Hls{ - FragmentsPerTsSegment: to.Int32Ptr(5), + FragmentsPerTsSegment: to.Ptr[int32](5), }, - ManifestName: to.StringPtr(""), + ManifestName: to.Ptr(""), }, }, - nil) + &armmediaservices.LiveOutputsClientBeginCreateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.LiveOutputsClientCreateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveoutput-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/liveoutput-delete.json func ExampleLiveOutputsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLiveOutputsClient("", cred, nil) + client, err := armmediaservices.NewLiveOutputsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "", "", "", "", - nil) + &armmediaservices.LiveOutputsClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_locations_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_locations_client_test.go index 12233a2a4fa7..77b6d7fc84b0 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_locations_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_locations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,23 +17,30 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-check-name-availability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-check-name-availability.json func ExampleLocationsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewLocationsClient("", cred, nil) + client, err := armmediaservices.NewLocationsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CheckNameAvailability(ctx, "", armmediaservices.CheckNameAvailabilityInput{ - Name: to.StringPtr(""), - Type: to.StringPtr(""), + Name: to.Ptr(""), + Type: to.Ptr(""), }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.LocationsClientCheckNameAvailabilityResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_mediaservices_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_mediaservices_client_test.go index d53140727ec5..a53a00b50099 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_mediaservices_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_mediaservices_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,67 +17,83 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-list-all-accounts.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-list-all-accounts.json func ExampleClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewClient("", cred, nil) + client, err := armmediaservices.NewClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-get-by-name.json func ExampleClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewClient("", cred, nil) + client, err := armmediaservices.NewClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-create.json func ExampleClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewClient("", cred, nil) + client, err := armmediaservices.NewClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", armmediaservices.MediaService{ - Location: to.StringPtr(""), + Location: to.Ptr(""), Tags: map[string]*string{ - "key1": to.StringPtr("value1"), - "key2": to.StringPtr("value2"), + "key1": to.Ptr("value1"), + "key2": to.Ptr("value2"), }, Identity: &armmediaservices.MediaServiceIdentity{ - Type: to.StringPtr(""), + Type: to.Ptr(""), UserAssignedIdentities: map[string]*armmediaservices.UserAssignedManagedIdentity{ "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}, "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2": {}, @@ -85,134 +101,166 @@ func ExampleClient_CreateOrUpdate() { }, Properties: &armmediaservices.MediaServiceProperties{ Encryption: &armmediaservices.AccountEncryption{ - Type: armmediaservices.AccountEncryptionKeyType("CustomerKey").ToPtr(), + Type: to.Ptr(armmediaservices.AccountEncryptionKeyTypeCustomerKey), Identity: &armmediaservices.ResourceIdentity{ - UseSystemAssignedIdentity: to.BoolPtr(false), - UserAssignedIdentity: to.StringPtr(""), + UseSystemAssignedIdentity: to.Ptr(false), + UserAssignedIdentity: to.Ptr(""), }, KeyVaultProperties: &armmediaservices.KeyVaultProperties{ - KeyIdentifier: to.StringPtr(""), + KeyIdentifier: to.Ptr(""), }, }, StorageAccounts: []*armmediaservices.StorageAccount{ { - Type: armmediaservices.StorageAccountType("Primary").ToPtr(), - ID: to.StringPtr(""), + Type: to.Ptr(armmediaservices.StorageAccountTypePrimary), + ID: to.Ptr(""), Identity: &armmediaservices.ResourceIdentity{ - UseSystemAssignedIdentity: to.BoolPtr(false), - UserAssignedIdentity: to.StringPtr(""), + UseSystemAssignedIdentity: to.Ptr(false), + UserAssignedIdentity: to.Ptr(""), }, }}, - StorageAuthentication: armmediaservices.StorageAuthentication("ManagedIdentity").ToPtr(), + StorageAuthentication: to.Ptr(armmediaservices.StorageAuthenticationManagedIdentity), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-delete.json func ExampleClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewClient("", cred, nil) + client, err := armmediaservices.NewClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-update.json func ExampleClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewClient("", cred, nil) + client, err := armmediaservices.NewClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", armmediaservices.MediaServiceUpdate{ Tags: map[string]*string{ - "key1": to.StringPtr("value3"), + "key1": to.Ptr("value3"), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-sync-storage-keys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-sync-storage-keys.json func ExampleClient_SyncStorageKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewClient("", cred, nil) + client, err := armmediaservices.NewClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.SyncStorageKeys(ctx, "", "", armmediaservices.SyncStorageKeysInput{ - ID: to.StringPtr(""), + ID: to.Ptr(""), }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-list-media-edge-policies.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-list-media-edge-policies.json func ExampleClient_ListEdgePolicies() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewClient("", cred, nil) + client, err := armmediaservices.NewClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListEdgePolicies(ctx, "", "", armmediaservices.ListEdgePoliciesInput{ - DeviceID: to.StringPtr(""), + DeviceID: to.Ptr(""), }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ClientListEdgePoliciesResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-subscription-list-all-accounts.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/accounts-subscription-list-all-accounts.json func ExampleClient_ListBySubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewClient("", cred, nil) + client, err := armmediaservices.NewClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListBySubscription(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_operationresults_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_operationresults_client_test.go index 0d25e4717fd1..a765de8f642f 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_operationresults_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_operationresults_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,14 +16,19 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-operation-result-by-id.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-operation-result-by-id.json func ExampleOperationResultsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewOperationResultsClient("", cred, nil) + client, err := armmediaservices.NewOperationResultsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", @@ -32,7 +37,9 @@ func ExampleOperationResultsClient_Get() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.OperationResultsClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_operations_client_test.go index 42aef0292e37..7bd45c38410a 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_operations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,18 +16,25 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/operations-list-all.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/operations-list-all.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewOperationsClient(cred, nil) + client, err := armmediaservices.NewOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.OperationsClientListResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_operationstatuses_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_operationstatuses_client_test.go index 81be4ba62e27..ca17a74bb985 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_operationstatuses_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_operationstatuses_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,14 +16,19 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-operation-status-by-id-terminal-state-failed.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-operation-status-by-id-terminal-state-failed.json func ExampleOperationStatusesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewOperationStatusesClient("", cred, nil) + client, err := armmediaservices.NewOperationStatusesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", @@ -32,7 +37,9 @@ func ExampleOperationStatusesClient_Get() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.OperationStatusesClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_privateendpointconnections_client_test.go index d971068af50d..c0095907d9fb 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_privateendpointconnections_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_privateendpointconnections_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,51 +17,70 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/private-endpoint-connection-list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/private-endpoint-connection-list.json func ExamplePrivateEndpointConnectionsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewPrivateEndpointConnectionsClient("", cred, nil) + client, err := armmediaservices.NewPrivateEndpointConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientListResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/private-endpoint-connection-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/private-endpoint-connection-get-by-name.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewPrivateEndpointConnectionsClient("", cred, nil) + client, err := armmediaservices.NewPrivateEndpointConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/private-endpoint-connection-put.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/private-endpoint-connection-put.json func ExamplePrivateEndpointConnectionsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewPrivateEndpointConnectionsClient("", cred, nil) + client, err := armmediaservices.NewPrivateEndpointConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", @@ -69,32 +88,40 @@ func ExamplePrivateEndpointConnectionsClient_CreateOrUpdate() { armmediaservices.PrivateEndpointConnection{ Properties: &armmediaservices.PrivateEndpointConnectionProperties{ PrivateLinkServiceConnectionState: &armmediaservices.PrivateLinkServiceConnectionState{ - Description: to.StringPtr(""), - Status: armmediaservices.PrivateEndpointServiceConnectionStatus("Approved").ToPtr(), + Description: to.Ptr(""), + Status: to.Ptr(armmediaservices.PrivateEndpointServiceConnectionStatusApproved), }, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/private-endpoint-connection-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/private-endpoint-connection-delete.json func ExamplePrivateEndpointConnectionsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewPrivateEndpointConnectionsClient("", cred, nil) + client, err := armmediaservices.NewPrivateEndpointConnectionsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_privatelinkresources_client_test.go index 012a45504961..5bc9aea9ae70 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_privatelinkresources_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_privatelinkresources_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,39 +16,53 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/private-link-resources-list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/private-link-resources-list.json func ExamplePrivateLinkResourcesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewPrivateLinkResourcesClient("", cred, nil) + client, err := armmediaservices.NewPrivateLinkResourcesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateLinkResourcesClientListResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/private-link-resources-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-06-01/examples/private-link-resources-get-by-name.json func ExamplePrivateLinkResourcesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewPrivateLinkResourcesClient("", cred, nil) + client, err := armmediaservices.NewPrivateLinkResourcesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateLinkResourcesClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_streamingendpoints_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_streamingendpoints_client_test.go index f463a95995ba..aa88d632b380 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_streamingendpoints_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_streamingendpoints_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,230 +19,287 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-list-all.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-list-all.json func ExampleStreamingEndpointsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + client, err := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-list-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-list-by-name.json func ExampleStreamingEndpointsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + client, err := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.StreamingEndpointsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-create.json func ExampleStreamingEndpointsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + client, err := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreate(ctx, "", "", "", armmediaservices.StreamingEndpoint{ - Location: to.StringPtr(""), + Location: to.Ptr(""), Tags: map[string]*string{ - "tag1": to.StringPtr("value1"), - "tag2": to.StringPtr("value2"), + "tag1": to.Ptr("value1"), + "tag2": to.Ptr("value2"), }, Properties: &armmediaservices.StreamingEndpointProperties{ - Description: to.StringPtr(""), + Description: to.Ptr(""), AccessControl: &armmediaservices.StreamingEndpointAccessControl{ Akamai: &armmediaservices.AkamaiAccessControl{ AkamaiSignatureHeaderAuthenticationKeyList: []*armmediaservices.AkamaiSignatureHeaderAuthenticationKey{ { - Base64Key: to.StringPtr(""), - Expiration: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2029-12-31T16:00:00-08:00"); return t }()), - Identifier: to.StringPtr(""), + Base64Key: to.Ptr(""), + Expiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2029-12-31T16:00:00-08:00"); return t }()), + Identifier: to.Ptr(""), }, { - Base64Key: to.StringPtr(""), - Expiration: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2030-12-31T16:00:00-08:00"); return t }()), - Identifier: to.StringPtr(""), + Base64Key: to.Ptr(""), + Expiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2030-12-31T16:00:00-08:00"); return t }()), + Identifier: to.Ptr(""), }}, }, IP: &armmediaservices.IPAccessControl{ Allow: []*armmediaservices.IPRange{ { - Name: to.StringPtr(""), - Address: to.StringPtr("
"), + Name: to.Ptr(""), + Address: to.Ptr("
"), }}, }, }, - AvailabilitySetName: to.StringPtr(""), - CdnEnabled: to.BoolPtr(false), - ScaleUnits: to.Int32Ptr(1), + AvailabilitySetName: to.Ptr(""), + CdnEnabled: to.Ptr(false), + ScaleUnits: to.Ptr[int32](1), }, }, - &armmediaservices.StreamingEndpointsClientBeginCreateOptions{AutoStart: nil}) + &armmediaservices.StreamingEndpointsClientBeginCreateOptions{AutoStart: nil, + ResumeToken: "", + }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.StreamingEndpointsClientCreateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-update.json func ExampleStreamingEndpointsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + client, err := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginUpdate(ctx, "", "", "", armmediaservices.StreamingEndpoint{ - Location: to.StringPtr(""), + Location: to.Ptr(""), Tags: map[string]*string{ - "tag3": to.StringPtr("value3"), - "tag5": to.StringPtr("value5"), + "tag3": to.Ptr("value3"), + "tag5": to.Ptr("value5"), }, Properties: &armmediaservices.StreamingEndpointProperties{ - Description: to.StringPtr(""), - AvailabilitySetName: to.StringPtr(""), - ScaleUnits: to.Int32Ptr(5), + Description: to.Ptr(""), + AvailabilitySetName: to.Ptr(""), + ScaleUnits: to.Ptr[int32](5), }, }, - nil) + &armmediaservices.StreamingEndpointsClientBeginUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.StreamingEndpointsClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-delete.json func ExampleStreamingEndpointsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + client, err := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "", "", "", - nil) + &armmediaservices.StreamingEndpointsClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-start.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-start.json func ExampleStreamingEndpointsClient_BeginStart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + client, err := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginStart(ctx, "", "", "", - nil) + &armmediaservices.StreamingEndpointsClientBeginStartOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-stop.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-stop.json func ExampleStreamingEndpointsClient_BeginStop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + client, err := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginStop(ctx, "", "", "", - nil) + &armmediaservices.StreamingEndpointsClientBeginStopOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-scale.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streamingendpoint-scale.json func ExampleStreamingEndpointsClient_BeginScale() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + client, err := armmediaservices.NewStreamingEndpointsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginScale(ctx, "", "", "", armmediaservices.StreamingEntityScaleUnit{ - ScaleUnit: to.Int32Ptr(5), + ScaleUnit: to.Ptr[int32](5), }, - nil) + &armmediaservices.StreamingEndpointsClientBeginScaleOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_streaminglocators_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_streaminglocators_client_test.go index 72c7f83f568f..1e6bf67f67b2 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_streaminglocators_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_streaminglocators_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,129 +17,166 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-locators-list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-locators-list.json func ExampleStreamingLocatorsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingLocatorsClient("", cred, nil) + client, err := armmediaservices.NewStreamingLocatorsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", &armmediaservices.StreamingLocatorsClientListOptions{Filter: nil, Top: nil, Orderby: nil, }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-locators-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-locators-get-by-name.json func ExampleStreamingLocatorsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingLocatorsClient("", cred, nil) + client, err := armmediaservices.NewStreamingLocatorsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.StreamingLocatorsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-locators-create-clear.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-locators-create-clear.json func ExampleStreamingLocatorsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingLocatorsClient("", cred, nil) + client, err := armmediaservices.NewStreamingLocatorsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Create(ctx, "", "", "", armmediaservices.StreamingLocator{ Properties: &armmediaservices.StreamingLocatorProperties{ - AssetName: to.StringPtr(""), - StreamingPolicyName: to.StringPtr(""), + AssetName: to.Ptr(""), + StreamingPolicyName: to.Ptr(""), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-locators-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-locators-delete.json func ExampleStreamingLocatorsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingLocatorsClient("", cred, nil) + client, err := armmediaservices.NewStreamingLocatorsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-locators-list-content-keys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-locators-list-content-keys.json func ExampleStreamingLocatorsClient_ListContentKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingLocatorsClient("", cred, nil) + client, err := armmediaservices.NewStreamingLocatorsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListContentKeys(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.StreamingLocatorsClientListContentKeysResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-locators-list-paths-streaming-and-download.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-locators-list-paths-streaming-and-download.json func ExampleStreamingLocatorsClient_ListPaths() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingLocatorsClient("", cred, nil) + client, err := armmediaservices.NewStreamingLocatorsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListPaths(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.StreamingLocatorsClientListPathsResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_streamingpolicies_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_streamingpolicies_client_test.go index 1dad3aa5cbb6..b212f99304f4 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_streamingpolicies_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_streamingpolicies_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,61 +17,77 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-policies-list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-policies-list.json func ExampleStreamingPoliciesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingPoliciesClient("", cred, nil) + client, err := armmediaservices.NewStreamingPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", &armmediaservices.StreamingPoliciesClientListOptions{Filter: nil, Top: nil, Orderby: nil, }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-policy-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-policy-get-by-name.json func ExampleStreamingPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingPoliciesClient("", cred, nil) + client, err := armmediaservices.NewStreamingPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.StreamingPoliciesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-policies-create-clear.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-policies-create-clear.json func ExampleStreamingPoliciesClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingPoliciesClient("", cred, nil) + client, err := armmediaservices.NewStreamingPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Create(ctx, "", "", @@ -80,34 +96,41 @@ func ExampleStreamingPoliciesClient_Create() { Properties: &armmediaservices.StreamingPolicyProperties{ NoEncryption: &armmediaservices.NoEncryption{ EnabledProtocols: &armmediaservices.EnabledProtocols{ - Dash: to.BoolPtr(true), - Download: to.BoolPtr(true), - Hls: to.BoolPtr(true), - SmoothStreaming: to.BoolPtr(true), + Dash: to.Ptr(true), + Download: to.Ptr(true), + Hls: to.Ptr(true), + SmoothStreaming: to.Ptr(true), }, }, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-policies-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/streaming-policies-delete.json func ExampleStreamingPoliciesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewStreamingPoliciesClient("", cred, nil) + client, err := armmediaservices.NewStreamingPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_tracks_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_tracks_client_test.go index bb933eb28843..61f552bd7025 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_tracks_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_tracks_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,33 +19,49 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-list-all.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-list-all.json func ExampleTracksClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewTracksClient("", cred, nil) - res, err := client.List(ctx, - "", + client, err := armmediaservices.NewTracksClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } + pager := client.List("", "", "", nil) - if err != nil { - log.Fatal(err) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + return + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - log.Printf("Response result: %#v\n", res.TracksClientListResult) } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-get-by-name.json func ExampleTracksClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewTracksClient("", cred, nil) + client, err := armmediaservices.NewTracksClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", @@ -53,19 +69,26 @@ func ExampleTracksClient_Get() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.TracksClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-create.json func ExampleTracksClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewTracksClient("", cred, nil) + client, err := armmediaservices.NewTracksClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "", "", @@ -74,55 +97,70 @@ func ExampleTracksClient_BeginCreateOrUpdate() { armmediaservices.AssetTrack{ Properties: &armmediaservices.AssetTrackProperties{ Track: &armmediaservices.TextTrack{ - ODataType: to.StringPtr(""), - DisplayName: to.StringPtr(""), - FileName: to.StringPtr(""), - PlayerVisibility: armmediaservices.Visibility("Visible").ToPtr(), + ODataType: to.Ptr(""), + DisplayName: to.Ptr(""), + FileName: to.Ptr(""), + PlayerVisibility: to.Ptr(armmediaservices.VisibilityVisible), }, }, }, - nil) + &armmediaservices.TracksClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.TracksClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-delete.json func ExampleTracksClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewTracksClient("", cred, nil) + client, err := armmediaservices.NewTracksClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "", "", "", "", - nil) + &armmediaservices.TracksClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-update.json func ExampleTracksClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewTracksClient("", cred, nil) + client, err := armmediaservices.NewTracksClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginUpdate(ctx, "", "", @@ -131,40 +169,49 @@ func ExampleTracksClient_BeginUpdate() { armmediaservices.AssetTrack{ Properties: &armmediaservices.AssetTrackProperties{ Track: &armmediaservices.TextTrack{ - ODataType: to.StringPtr(""), - DisplayName: to.StringPtr(""), + ODataType: to.Ptr(""), + DisplayName: to.Ptr(""), }, }, }, - nil) + &armmediaservices.TracksClientBeginUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-update-data.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/asset-tracks-update-data.json func ExampleTracksClient_BeginUpdateTrackData() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewTracksClient("", cred, nil) + client, err := armmediaservices.NewTracksClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginUpdateTrackData(ctx, "", "", "", "", - nil) + &armmediaservices.TracksClientBeginUpdateTrackDataOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_transforms_client_test.go b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_transforms_client_test.go index d178977ae991..2722d89b6ada 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_transforms_client_test.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ze_generated_example_transforms_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,129 +17,160 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices" ) -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/transforms-list-all.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/transforms-list-all.json func ExampleTransformsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewTransformsClient("", cred, nil) + client, err := armmediaservices.NewTransformsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", &armmediaservices.TransformsClientListOptions{Filter: nil, Orderby: nil, }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/transforms-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/transforms-get-by-name.json func ExampleTransformsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewTransformsClient("", cred, nil) + client, err := armmediaservices.NewTransformsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.TransformsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/transforms-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/transforms-create.json func ExampleTransformsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewTransformsClient("", cred, nil) + client, err := armmediaservices.NewTransformsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", "", armmediaservices.Transform{ Properties: &armmediaservices.TransformProperties{ - Description: to.StringPtr(""), + Description: to.Ptr(""), Outputs: []*armmediaservices.TransformOutput{ { Preset: &armmediaservices.BuiltInStandardEncoderPreset{ - ODataType: to.StringPtr(""), - PresetName: armmediaservices.EncoderNamedPreset("AdaptiveStreaming").ToPtr(), + ODataType: to.Ptr(""), + PresetName: to.Ptr(armmediaservices.EncoderNamedPresetAdaptiveStreaming), }, }}, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.TransformsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/transforms-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/transforms-delete.json func ExampleTransformsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewTransformsClient("", cred, nil) + client, err := armmediaservices.NewTransformsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/transforms-update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2021-11-01/examples/transforms-update.json func ExampleTransformsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armmediaservices.NewTransformsClient("", cred, nil) + client, err := armmediaservices.NewTransformsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", "", armmediaservices.Transform{ Properties: &armmediaservices.TransformProperties{ - Description: to.StringPtr(""), + Description: to.Ptr(""), Outputs: []*armmediaservices.TransformOutput{ { Preset: &armmediaservices.BuiltInStandardEncoderPreset{ - ODataType: to.StringPtr(""), - PresetName: armmediaservices.EncoderNamedPreset("H264MultipleBitrate720p").ToPtr(), + ODataType: to.Ptr(""), + PresetName: to.Ptr(armmediaservices.EncoderNamedPresetH264MultipleBitrate720P), }, - RelativePriority: armmediaservices.Priority("High").ToPtr(), + RelativePriority: to.Ptr(armmediaservices.PriorityHigh), }}, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.TransformsClientUpdateResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_accountfilters_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_accountfilters_client.go index ea482698f1d7..bbf5c45bad9b 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_accountfilters_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_accountfilters_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type AccountFiltersClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewAccountFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccountFiltersClient { +func NewAccountFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountFiltersClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &AccountFiltersClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Creates or updates an Account Filter in the Media Services account. @@ -104,7 +109,7 @@ func (client *AccountFiltersClient) createOrUpdateCreateRequest(ctx context.Cont // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *AccountFiltersClient) createOrUpdateHandleResponse(resp *http.Response) (AccountFiltersClientCreateOrUpdateResponse, error) { - result := AccountFiltersClientCreateOrUpdateResponse{RawResponse: resp} + result := AccountFiltersClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccountFilter); err != nil { return AccountFiltersClientCreateOrUpdateResponse{}, err } @@ -129,7 +134,7 @@ func (client *AccountFiltersClient) Delete(ctx context.Context, resourceGroupNam if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return AccountFiltersClientDeleteResponse{}, runtime.NewResponseError(resp) } - return AccountFiltersClientDeleteResponse{RawResponse: resp}, nil + return AccountFiltersClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -215,7 +220,7 @@ func (client *AccountFiltersClient) getCreateRequest(ctx context.Context, resour // getHandleResponse handles the Get response. func (client *AccountFiltersClient) getHandleResponse(resp *http.Response) (AccountFiltersClientGetResponse, error) { - result := AccountFiltersClientGetResponse{RawResponse: resp} + result := AccountFiltersClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccountFilter); err != nil { return AccountFiltersClientGetResponse{}, err } @@ -227,16 +232,32 @@ func (client *AccountFiltersClient) getHandleResponse(resp *http.Response) (Acco // resourceGroupName - The name of the resource group within the Azure subscription. // accountName - The Media Services account name. // options - AccountFiltersClientListOptions contains the optional parameters for the AccountFiltersClient.List method. -func (client *AccountFiltersClient) List(resourceGroupName string, accountName string, options *AccountFiltersClientListOptions) *AccountFiltersClientListPager { - return &AccountFiltersClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *AccountFiltersClient) List(resourceGroupName string, accountName string, options *AccountFiltersClientListOptions) *runtime.Pager[AccountFiltersClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[AccountFiltersClientListResponse]{ + More: func(page AccountFiltersClientListResponse) bool { + return page.ODataNextLink != nil && len(*page.ODataNextLink) > 0 }, - advancer: func(ctx context.Context, resp AccountFiltersClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.AccountFilterCollection.ODataNextLink) + Fetcher: func(ctx context.Context, page *AccountFiltersClientListResponse) (AccountFiltersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink) + } + if err != nil { + return AccountFiltersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccountFiltersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccountFiltersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -267,7 +288,7 @@ func (client *AccountFiltersClient) listCreateRequest(ctx context.Context, resou // listHandleResponse handles the List response. func (client *AccountFiltersClient) listHandleResponse(resp *http.Response) (AccountFiltersClientListResponse, error) { - result := AccountFiltersClientListResponse{RawResponse: resp} + result := AccountFiltersClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccountFilterCollection); err != nil { return AccountFiltersClientListResponse{}, err } @@ -328,7 +349,7 @@ func (client *AccountFiltersClient) updateCreateRequest(ctx context.Context, res // updateHandleResponse handles the Update response. func (client *AccountFiltersClient) updateHandleResponse(resp *http.Response) (AccountFiltersClientUpdateResponse, error) { - result := AccountFiltersClientUpdateResponse{RawResponse: resp} + result := AccountFiltersClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccountFilter); err != nil { return AccountFiltersClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assetfilters_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assetfilters_client.go index 9492cc44a159..a918767c0c25 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assetfilters_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assetfilters_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type AssetFiltersClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewAssetFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AssetFiltersClient { +func NewAssetFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssetFiltersClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &AssetFiltersClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Creates or updates an Asset Filter associated with the specified Asset. @@ -109,7 +114,7 @@ func (client *AssetFiltersClient) createOrUpdateCreateRequest(ctx context.Contex // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *AssetFiltersClient) createOrUpdateHandleResponse(resp *http.Response) (AssetFiltersClientCreateOrUpdateResponse, error) { - result := AssetFiltersClientCreateOrUpdateResponse{RawResponse: resp} + result := AssetFiltersClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AssetFilter); err != nil { return AssetFiltersClientCreateOrUpdateResponse{}, err } @@ -135,7 +140,7 @@ func (client *AssetFiltersClient) Delete(ctx context.Context, resourceGroupName if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return AssetFiltersClientDeleteResponse{}, runtime.NewResponseError(resp) } - return AssetFiltersClientDeleteResponse{RawResponse: resp}, nil + return AssetFiltersClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -230,7 +235,7 @@ func (client *AssetFiltersClient) getCreateRequest(ctx context.Context, resource // getHandleResponse handles the Get response. func (client *AssetFiltersClient) getHandleResponse(resp *http.Response) (AssetFiltersClientGetResponse, error) { - result := AssetFiltersClientGetResponse{RawResponse: resp} + result := AssetFiltersClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AssetFilter); err != nil { return AssetFiltersClientGetResponse{}, err } @@ -243,16 +248,32 @@ func (client *AssetFiltersClient) getHandleResponse(resp *http.Response) (AssetF // accountName - The Media Services account name. // assetName - The Asset name. // options - AssetFiltersClientListOptions contains the optional parameters for the AssetFiltersClient.List method. -func (client *AssetFiltersClient) List(resourceGroupName string, accountName string, assetName string, options *AssetFiltersClientListOptions) *AssetFiltersClientListPager { - return &AssetFiltersClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, assetName, options) +func (client *AssetFiltersClient) List(resourceGroupName string, accountName string, assetName string, options *AssetFiltersClientListOptions) *runtime.Pager[AssetFiltersClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[AssetFiltersClientListResponse]{ + More: func(page AssetFiltersClientListResponse) bool { + return page.ODataNextLink != nil && len(*page.ODataNextLink) > 0 }, - advancer: func(ctx context.Context, resp AssetFiltersClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.AssetFilterCollection.ODataNextLink) + Fetcher: func(ctx context.Context, page *AssetFiltersClientListResponse) (AssetFiltersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, assetName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink) + } + if err != nil { + return AssetFiltersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssetFiltersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssetFiltersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -287,7 +308,7 @@ func (client *AssetFiltersClient) listCreateRequest(ctx context.Context, resourc // listHandleResponse handles the List response. func (client *AssetFiltersClient) listHandleResponse(resp *http.Response) (AssetFiltersClientListResponse, error) { - result := AssetFiltersClientListResponse{RawResponse: resp} + result := AssetFiltersClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AssetFilterCollection); err != nil { return AssetFiltersClientListResponse{}, err } @@ -353,7 +374,7 @@ func (client *AssetFiltersClient) updateCreateRequest(ctx context.Context, resou // updateHandleResponse handles the Update response. func (client *AssetFiltersClient) updateHandleResponse(resp *http.Response) (AssetFiltersClientUpdateResponse, error) { - result := AssetFiltersClientUpdateResponse{RawResponse: resp} + result := AssetFiltersClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AssetFilter); err != nil { return AssetFiltersClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assets_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assets_client.go index 69d5ec780a01..f23c70c10743 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assets_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assets_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type AssetsClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewAssetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AssetsClient { +func NewAssetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssetsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &AssetsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Creates or updates an Asset in the Media Services account @@ -104,7 +109,7 @@ func (client *AssetsClient) createOrUpdateCreateRequest(ctx context.Context, res // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *AssetsClient) createOrUpdateHandleResponse(resp *http.Response) (AssetsClientCreateOrUpdateResponse, error) { - result := AssetsClientCreateOrUpdateResponse{RawResponse: resp} + result := AssetsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Asset); err != nil { return AssetsClientCreateOrUpdateResponse{}, err } @@ -129,7 +134,7 @@ func (client *AssetsClient) Delete(ctx context.Context, resourceGroupName string if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return AssetsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return AssetsClientDeleteResponse{RawResponse: resp}, nil + return AssetsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -215,7 +220,7 @@ func (client *AssetsClient) getCreateRequest(ctx context.Context, resourceGroupN // getHandleResponse handles the Get response. func (client *AssetsClient) getHandleResponse(resp *http.Response) (AssetsClientGetResponse, error) { - result := AssetsClientGetResponse{RawResponse: resp} + result := AssetsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Asset); err != nil { return AssetsClientGetResponse{}, err } @@ -276,7 +281,7 @@ func (client *AssetsClient) getEncryptionKeyCreateRequest(ctx context.Context, r // getEncryptionKeyHandleResponse handles the GetEncryptionKey response. func (client *AssetsClient) getEncryptionKeyHandleResponse(resp *http.Response) (AssetsClientGetEncryptionKeyResponse, error) { - result := AssetsClientGetEncryptionKeyResponse{RawResponse: resp} + result := AssetsClientGetEncryptionKeyResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.StorageEncryptedAssetDecryptionData); err != nil { return AssetsClientGetEncryptionKeyResponse{}, err } @@ -288,16 +293,32 @@ func (client *AssetsClient) getEncryptionKeyHandleResponse(resp *http.Response) // resourceGroupName - The name of the resource group within the Azure subscription. // accountName - The Media Services account name. // options - AssetsClientListOptions contains the optional parameters for the AssetsClient.List method. -func (client *AssetsClient) List(resourceGroupName string, accountName string, options *AssetsClientListOptions) *AssetsClientListPager { - return &AssetsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *AssetsClient) List(resourceGroupName string, accountName string, options *AssetsClientListOptions) *runtime.Pager[AssetsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[AssetsClientListResponse]{ + More: func(page AssetsClientListResponse) bool { + return page.ODataNextLink != nil && len(*page.ODataNextLink) > 0 }, - advancer: func(ctx context.Context, resp AssetsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.AssetCollection.ODataNextLink) + Fetcher: func(ctx context.Context, page *AssetsClientListResponse) (AssetsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink) + } + if err != nil { + return AssetsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssetsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssetsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -337,7 +358,7 @@ func (client *AssetsClient) listCreateRequest(ctx context.Context, resourceGroup // listHandleResponse handles the List response. func (client *AssetsClient) listHandleResponse(resp *http.Response) (AssetsClientListResponse, error) { - result := AssetsClientListResponse{RawResponse: resp} + result := AssetsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AssetCollection); err != nil { return AssetsClientListResponse{}, err } @@ -399,7 +420,7 @@ func (client *AssetsClient) listContainerSasCreateRequest(ctx context.Context, r // listContainerSasHandleResponse handles the ListContainerSas response. func (client *AssetsClient) listContainerSasHandleResponse(resp *http.Response) (AssetsClientListContainerSasResponse, error) { - result := AssetsClientListContainerSasResponse{RawResponse: resp} + result := AssetsClientListContainerSasResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AssetContainerSas); err != nil { return AssetsClientListContainerSasResponse{}, err } @@ -460,7 +481,7 @@ func (client *AssetsClient) listStreamingLocatorsCreateRequest(ctx context.Conte // listStreamingLocatorsHandleResponse handles the ListStreamingLocators response. func (client *AssetsClient) listStreamingLocatorsHandleResponse(resp *http.Response) (AssetsClientListStreamingLocatorsResponse, error) { - result := AssetsClientListStreamingLocatorsResponse{RawResponse: resp} + result := AssetsClientListStreamingLocatorsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListStreamingLocatorsResponse); err != nil { return AssetsClientListStreamingLocatorsResponse{}, err } @@ -521,7 +542,7 @@ func (client *AssetsClient) updateCreateRequest(ctx context.Context, resourceGro // updateHandleResponse handles the Update response. func (client *AssetsClient) updateHandleResponse(resp *http.Response) (AssetsClientUpdateResponse, error) { - result := AssetsClientUpdateResponse{RawResponse: resp} + result := AssetsClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Asset); err != nil { return AssetsClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_client.go index db6e0b5fa0cd..c44ba1e4efef 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type Client struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *Client { +func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &Client{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Creates or updates a Media Services account @@ -98,7 +103,7 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *Client) createOrUpdateHandleResponse(resp *http.Response) (ClientCreateOrUpdateResponse, error) { - result := ClientCreateOrUpdateResponse{RawResponse: resp} + result := ClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.MediaService); err != nil { return ClientCreateOrUpdateResponse{}, err } @@ -122,7 +127,7 @@ func (client *Client) Delete(ctx context.Context, resourceGroupName string, acco if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return ClientDeleteResponse{}, runtime.NewResponseError(resp) } - return ClientDeleteResponse{RawResponse: resp}, nil + return ClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -199,7 +204,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName st // getHandleResponse handles the Get response. func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, error) { - result := ClientGetResponse{RawResponse: resp} + result := ClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.MediaService); err != nil { return ClientGetResponse{}, err } @@ -210,16 +215,32 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group within the Azure subscription. // options - ClientListOptions contains the optional parameters for the Client.List method. -func (client *Client) List(resourceGroupName string, options *ClientListOptions) *ClientListPager { - return &ClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, options) +func (client *Client) List(resourceGroupName string, options *ClientListOptions) *runtime.Pager[ClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ClientListResponse]{ + More: func(page ClientListResponse) bool { + return page.ODataNextLink != nil && len(*page.ODataNextLink) > 0 }, - advancer: func(ctx context.Context, resp ClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.MediaServiceCollection.ODataNextLink) + Fetcher: func(ctx context.Context, page *ClientListResponse) (ClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink) + } + if err != nil { + return ClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -246,7 +267,7 @@ func (client *Client) listCreateRequest(ctx context.Context, resourceGroupName s // listHandleResponse handles the List response. func (client *Client) listHandleResponse(resp *http.Response) (ClientListResponse, error) { - result := ClientListResponse{RawResponse: resp} + result := ClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.MediaServiceCollection); err != nil { return ClientListResponse{}, err } @@ -256,16 +277,32 @@ func (client *Client) listHandleResponse(resp *http.Response) (ClientListRespons // ListBySubscription - List Media Services accounts in the subscription. // If the operation fails it returns an *azcore.ResponseError type. // options - ClientListBySubscriptionOptions contains the optional parameters for the Client.ListBySubscription method. -func (client *Client) ListBySubscription(options *ClientListBySubscriptionOptions) *ClientListBySubscriptionPager { - return &ClientListBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) +func (client *Client) ListBySubscription(options *ClientListBySubscriptionOptions) *runtime.Pager[ClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[ClientListBySubscriptionResponse]{ + More: func(page ClientListBySubscriptionResponse) bool { + return page.ODataNextLink != nil && len(*page.ODataNextLink) > 0 }, - advancer: func(ctx context.Context, resp ClientListBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.MediaServiceCollection.ODataNextLink) + Fetcher: func(ctx context.Context, page *ClientListBySubscriptionResponse) (ClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink) + } + if err != nil { + return ClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) }, - } + }) } // listBySubscriptionCreateRequest creates the ListBySubscription request. @@ -288,7 +325,7 @@ func (client *Client) listBySubscriptionCreateRequest(ctx context.Context, optio // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *Client) listBySubscriptionHandleResponse(resp *http.Response) (ClientListBySubscriptionResponse, error) { - result := ClientListBySubscriptionResponse{RawResponse: resp} + result := ClientListBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.MediaServiceCollection); err != nil { return ClientListBySubscriptionResponse{}, err } @@ -344,7 +381,7 @@ func (client *Client) listEdgePoliciesCreateRequest(ctx context.Context, resourc // listEdgePoliciesHandleResponse handles the ListEdgePolicies response. func (client *Client) listEdgePoliciesHandleResponse(resp *http.Response) (ClientListEdgePoliciesResponse, error) { - result := ClientListEdgePoliciesResponse{RawResponse: resp} + result := ClientListEdgePoliciesResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.EdgePolicies); err != nil { return ClientListEdgePoliciesResponse{}, err } @@ -369,7 +406,7 @@ func (client *Client) SyncStorageKeys(ctx context.Context, resourceGroupName str if !runtime.HasStatusCode(resp, http.StatusOK) { return ClientSyncStorageKeysResponse{}, runtime.NewResponseError(resp) } - return ClientSyncStorageKeysResponse{RawResponse: resp}, nil + return ClientSyncStorageKeysResponse{}, nil } // syncStorageKeysCreateRequest creates the SyncStorageKeys request. @@ -447,7 +484,7 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName // updateHandleResponse handles the Update response. func (client *Client) updateHandleResponse(resp *http.Response) (ClientUpdateResponse, error) { - result := ClientUpdateResponse{RawResponse: resp} + result := ClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.MediaService); err != nil { return ClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_constants.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_constants.go index 4767f76bb60e..1f75971741c0 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_constants.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armmediaservices const ( moduleName = "armmediaservices" - moduleVersion = "v0.4.0" + moduleVersion = "v0.5.0" ) // AacAudioProfile - The encoding profile to be used when encoding audio with AAC. @@ -34,11 +34,6 @@ func PossibleAacAudioProfileValues() []AacAudioProfile { } } -// ToPtr returns a *AacAudioProfile pointing to the current value. -func (c AacAudioProfile) ToPtr() *AacAudioProfile { - return &c -} - // AccountEncryptionKeyType - The type of key used to encrypt the Account Key. type AccountEncryptionKeyType string @@ -57,11 +52,6 @@ func PossibleAccountEncryptionKeyTypeValues() []AccountEncryptionKeyType { } } -// ToPtr returns a *AccountEncryptionKeyType pointing to the current value. -func (c AccountEncryptionKeyType) ToPtr() *AccountEncryptionKeyType { - return &c -} - // ActionType - Indicates the action type. type ActionType string @@ -77,11 +67,6 @@ func PossibleActionTypeValues() []ActionType { } } -// ToPtr returns a *ActionType pointing to the current value. -func (c ActionType) ToPtr() *ActionType { - return &c -} - // AnalysisResolution - Specifies the maximum resolution at which your video is analyzed. The default behavior is "SourceResolution," // which will keep the input video at its original resolution when analyzed. Using // "StandardDefinition" will resize input videos to standard definition while preserving the appropriate aspect ratio. It @@ -105,11 +90,6 @@ func PossibleAnalysisResolutionValues() []AnalysisResolution { } } -// ToPtr returns a *AnalysisResolution pointing to the current value. -func (c AnalysisResolution) ToPtr() *AnalysisResolution { - return &c -} - // AssetContainerPermission - The permissions to set on the SAS URL. type AssetContainerPermission string @@ -131,11 +111,6 @@ func PossibleAssetContainerPermissionValues() []AssetContainerPermission { } } -// ToPtr returns a *AssetContainerPermission pointing to the current value. -func (c AssetContainerPermission) ToPtr() *AssetContainerPermission { - return &c -} - // AssetStorageEncryptionFormat - The Asset encryption format. One of None or MediaStorageEncryption. type AssetStorageEncryptionFormat string @@ -155,11 +130,6 @@ func PossibleAssetStorageEncryptionFormatValues() []AssetStorageEncryptionFormat } } -// ToPtr returns a *AssetStorageEncryptionFormat pointing to the current value. -func (c AssetStorageEncryptionFormat) ToPtr() *AssetStorageEncryptionFormat { - return &c -} - // AttributeFilter - The type of AttributeFilter to apply to the TrackAttribute in order to select the tracks. type AttributeFilter string @@ -186,11 +156,6 @@ func PossibleAttributeFilterValues() []AttributeFilter { } } -// ToPtr returns a *AttributeFilter pointing to the current value. -func (c AttributeFilter) ToPtr() *AttributeFilter { - return &c -} - // AudioAnalysisMode - Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode // would be chosen. type AudioAnalysisMode string @@ -213,11 +178,6 @@ func PossibleAudioAnalysisModeValues() []AudioAnalysisMode { } } -// ToPtr returns a *AudioAnalysisMode pointing to the current value. -func (c AudioAnalysisMode) ToPtr() *AudioAnalysisMode { - return &c -} - // BlurType - Blur type type BlurType string @@ -245,11 +205,6 @@ func PossibleBlurTypeValues() []BlurType { } } -// ToPtr returns a *BlurType pointing to the current value. -func (c BlurType) ToPtr() *BlurType { - return &c -} - // ChannelMapping - Optional designation for single channel audio tracks. Can be used to combine the tracks into stereo or // multi-channel audio tracks. type ChannelMapping string @@ -287,11 +242,6 @@ func PossibleChannelMappingValues() []ChannelMapping { } } -// ToPtr returns a *ChannelMapping pointing to the current value. -func (c ChannelMapping) ToPtr() *ChannelMapping { - return &c -} - // Complexity - Allows you to configure the encoder settings to control the balance between speed and quality. Example: set // Complexity as Speed for faster encoding but less compression efficiency. type Complexity string @@ -316,11 +266,6 @@ func PossibleComplexityValues() []Complexity { } } -// ToPtr returns a *Complexity pointing to the current value. -func (c Complexity) ToPtr() *Complexity { - return &c -} - // ContentKeyPolicyFairPlayRentalAndLeaseKeyType - The rental and lease key type. type ContentKeyPolicyFairPlayRentalAndLeaseKeyType string @@ -350,11 +295,6 @@ func PossibleContentKeyPolicyFairPlayRentalAndLeaseKeyTypeValues() []ContentKeyP } } -// ToPtr returns a *ContentKeyPolicyFairPlayRentalAndLeaseKeyType pointing to the current value. -func (c ContentKeyPolicyFairPlayRentalAndLeaseKeyType) ToPtr() *ContentKeyPolicyFairPlayRentalAndLeaseKeyType { - return &c -} - // ContentKeyPolicyPlayReadyContentType - The PlayReady content type. type ContentKeyPolicyPlayReadyContentType string @@ -380,11 +320,6 @@ func PossibleContentKeyPolicyPlayReadyContentTypeValues() []ContentKeyPolicyPlay } } -// ToPtr returns a *ContentKeyPolicyPlayReadyContentType pointing to the current value. -func (c ContentKeyPolicyPlayReadyContentType) ToPtr() *ContentKeyPolicyPlayReadyContentType { - return &c -} - // ContentKeyPolicyPlayReadyLicenseType - The license type. type ContentKeyPolicyPlayReadyLicenseType string @@ -407,11 +342,6 @@ func PossibleContentKeyPolicyPlayReadyLicenseTypeValues() []ContentKeyPolicyPlay } } -// ToPtr returns a *ContentKeyPolicyPlayReadyLicenseType pointing to the current value. -func (c ContentKeyPolicyPlayReadyLicenseType) ToPtr() *ContentKeyPolicyPlayReadyLicenseType { - return &c -} - // ContentKeyPolicyPlayReadyUnknownOutputPassingOption - Configures Unknown output handling settings of the license. type ContentKeyPolicyPlayReadyUnknownOutputPassingOption string @@ -440,11 +370,6 @@ func PossibleContentKeyPolicyPlayReadyUnknownOutputPassingOptionValues() []Conte } } -// ToPtr returns a *ContentKeyPolicyPlayReadyUnknownOutputPassingOption pointing to the current value. -func (c ContentKeyPolicyPlayReadyUnknownOutputPassingOption) ToPtr() *ContentKeyPolicyPlayReadyUnknownOutputPassingOption { - return &c -} - // ContentKeyPolicyRestrictionTokenType - The type of token. type ContentKeyPolicyRestrictionTokenType string @@ -467,11 +392,6 @@ func PossibleContentKeyPolicyRestrictionTokenTypeValues() []ContentKeyPolicyRest } } -// ToPtr returns a *ContentKeyPolicyRestrictionTokenType pointing to the current value. -func (c ContentKeyPolicyRestrictionTokenType) ToPtr() *ContentKeyPolicyRestrictionTokenType { - return &c -} - // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -492,11 +412,6 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// ToPtr returns a *CreatedByType pointing to the current value. -func (c CreatedByType) ToPtr() *CreatedByType { - return &c -} - // DefaultAction - The behavior for IP access control in Key Delivery. type DefaultAction string @@ -515,11 +430,6 @@ func PossibleDefaultActionValues() []DefaultAction { } } -// ToPtr returns a *DefaultAction pointing to the current value. -func (c DefaultAction) ToPtr() *DefaultAction { - return &c -} - // DeinterlaceMode - The deinterlacing mode. Defaults to AutoPixelAdaptive. type DeinterlaceMode string @@ -538,11 +448,6 @@ func PossibleDeinterlaceModeValues() []DeinterlaceMode { } } -// ToPtr returns a *DeinterlaceMode pointing to the current value. -func (c DeinterlaceMode) ToPtr() *DeinterlaceMode { - return &c -} - // DeinterlaceParity - The field parity for de-interlacing, defaults to Auto. type DeinterlaceParity string @@ -564,11 +469,6 @@ func PossibleDeinterlaceParityValues() []DeinterlaceParity { } } -// ToPtr returns a *DeinterlaceParity pointing to the current value. -func (c DeinterlaceParity) ToPtr() *DeinterlaceParity { - return &c -} - // EncoderNamedPreset - The built-in preset to be used for encoding videos. type EncoderNamedPreset string @@ -655,11 +555,6 @@ func PossibleEncoderNamedPresetValues() []EncoderNamedPreset { } } -// ToPtr returns a *EncoderNamedPreset pointing to the current value. -func (c EncoderNamedPreset) ToPtr() *EncoderNamedPreset { - return &c -} - // EncryptionScheme - Encryption scheme type EncryptionScheme string @@ -684,11 +579,6 @@ func PossibleEncryptionSchemeValues() []EncryptionScheme { } } -// ToPtr returns a *EncryptionScheme pointing to the current value. -func (c EncryptionScheme) ToPtr() *EncryptionScheme { - return &c -} - // EntropyMode - The entropy mode to be used for this layer. If not specified, the encoder chooses the mode that is appropriate // for the profile and level. type EntropyMode string @@ -708,11 +598,6 @@ func PossibleEntropyModeValues() []EntropyMode { } } -// ToPtr returns a *EntropyMode pointing to the current value. -func (c EntropyMode) ToPtr() *EntropyMode { - return &c -} - // FaceRedactorMode - This mode provides the ability to choose between the following settings: 1) Analyze - For detection // only.This mode generates a metadata JSON file marking appearances of faces throughout the // video.Where possible, appearances of the same person are assigned the same ID. 2) Combined - Additionally redacts(blurs) @@ -741,11 +626,6 @@ func PossibleFaceRedactorModeValues() []FaceRedactorMode { } } -// ToPtr returns a *FaceRedactorMode pointing to the current value. -func (c FaceRedactorMode) ToPtr() *FaceRedactorMode { - return &c -} - // FilterTrackPropertyCompareOperation - The track property condition operation. type FilterTrackPropertyCompareOperation string @@ -764,11 +644,6 @@ func PossibleFilterTrackPropertyCompareOperationValues() []FilterTrackPropertyCo } } -// ToPtr returns a *FilterTrackPropertyCompareOperation pointing to the current value. -func (c FilterTrackPropertyCompareOperation) ToPtr() *FilterTrackPropertyCompareOperation { - return &c -} - // FilterTrackPropertyType - The track property type. type FilterTrackPropertyType string @@ -799,11 +674,6 @@ func PossibleFilterTrackPropertyTypeValues() []FilterTrackPropertyType { } } -// ToPtr returns a *FilterTrackPropertyType pointing to the current value. -func (c FilterTrackPropertyType) ToPtr() *FilterTrackPropertyType { - return &c -} - // H264Complexity - Tells the encoder how to choose its encoding settings. The default value is Balanced. type H264Complexity string @@ -827,11 +697,6 @@ func PossibleH264ComplexityValues() []H264Complexity { } } -// ToPtr returns a *H264Complexity pointing to the current value. -func (c H264Complexity) ToPtr() *H264Complexity { - return &c -} - // H264RateControlMode - The video rate control mode type H264RateControlMode string @@ -853,11 +718,6 @@ func PossibleH264RateControlModeValues() []H264RateControlMode { } } -// ToPtr returns a *H264RateControlMode pointing to the current value. -func (c H264RateControlMode) ToPtr() *H264RateControlMode { - return &c -} - // H264VideoProfile - We currently support Baseline, Main, High, High422, High444. Default is Auto. type H264VideoProfile string @@ -888,11 +748,6 @@ func PossibleH264VideoProfileValues() []H264VideoProfile { } } -// ToPtr returns a *H264VideoProfile pointing to the current value. -func (c H264VideoProfile) ToPtr() *H264VideoProfile { - return &c -} - // H265Complexity - Tells the encoder how to choose its encoding settings. Quality will provide for a higher compression ratio // but at a higher cost and longer compute time. Speed will produce a relatively larger file but // is faster and more economical. The default value is Balanced. @@ -918,11 +773,6 @@ func PossibleH265ComplexityValues() []H265Complexity { } } -// ToPtr returns a *H265Complexity pointing to the current value. -func (c H265Complexity) ToPtr() *H265Complexity { - return &c -} - // H265VideoProfile - We currently support Main. Default is Auto. type H265VideoProfile string @@ -944,11 +794,6 @@ func PossibleH265VideoProfileValues() []H265VideoProfile { } } -// ToPtr returns a *H265VideoProfile pointing to the current value. -func (c H265VideoProfile) ToPtr() *H265VideoProfile { - return &c -} - // InsightsType - Defines the type of insights that you want the service to generate. The allowed values are 'AudioInsightsOnly', // 'VideoInsightsOnly', and 'AllInsights'. The default is AllInsights. If you set this to // AllInsights and the input is audio only, then only audio insights are generated. Similarly if the input is video only, @@ -975,11 +820,6 @@ func PossibleInsightsTypeValues() []InsightsType { } } -// ToPtr returns a *InsightsType pointing to the current value. -func (c InsightsType) ToPtr() *InsightsType { - return &c -} - // InterleaveOutput - Sets the interleave mode of the output to control how audio and video are stored in the container format. // Example: set InterleavedOutput as NonInterleavedOutput to produce audio-only and video-only // outputs in separate MP4 files. @@ -1000,11 +840,6 @@ func PossibleInterleaveOutputValues() []InterleaveOutput { } } -// ToPtr returns a *InterleaveOutput pointing to the current value. -func (c InterleaveOutput) ToPtr() *InterleaveOutput { - return &c -} - // JobErrorCategory - Helps with categorization of errors. type JobErrorCategory string @@ -1032,11 +867,6 @@ func PossibleJobErrorCategoryValues() []JobErrorCategory { } } -// ToPtr returns a *JobErrorCategory pointing to the current value. -func (c JobErrorCategory) ToPtr() *JobErrorCategory { - return &c -} - // JobErrorCode - Error code describing the error. type JobErrorCode string @@ -1083,11 +913,6 @@ func PossibleJobErrorCodeValues() []JobErrorCode { } } -// ToPtr returns a *JobErrorCode pointing to the current value. -func (c JobErrorCode) ToPtr() *JobErrorCode { - return &c -} - // JobRetry - Indicates that it may be possible to retry the Job. If retry is unsuccessful, please contact Azure support via // Azure Portal. type JobRetry string @@ -1108,11 +933,6 @@ func PossibleJobRetryValues() []JobRetry { } } -// ToPtr returns a *JobRetry pointing to the current value. -func (c JobRetry) ToPtr() *JobRetry { - return &c -} - // JobState - Describes the state of the JobOutput. type JobState string @@ -1147,11 +967,6 @@ func PossibleJobStateValues() []JobState { } } -// ToPtr returns a *JobState pointing to the current value. -func (c JobState) ToPtr() *JobState { - return &c -} - // LiveEventEncodingType - Live event type. When encodingType is set to PassthroughBasic or PassthroughStandard, the service // simply passes through the incoming video and audio layer(s) to the output. When encodingType is set to // Standard or Premium1080p, a live encoder transcodes the incoming stream into multiple bitrates or layers. See https://go.microsoft.com/fwlink/?linkid=2095101 @@ -1190,11 +1005,6 @@ func PossibleLiveEventEncodingTypeValues() []LiveEventEncodingType { } } -// ToPtr returns a *LiveEventEncodingType pointing to the current value. -func (c LiveEventEncodingType) ToPtr() *LiveEventEncodingType { - return &c -} - // LiveEventInputProtocol - The input protocol for the live event. This is specified at creation time and cannot be updated. type LiveEventInputProtocol string @@ -1213,11 +1023,6 @@ func PossibleLiveEventInputProtocolValues() []LiveEventInputProtocol { } } -// ToPtr returns a *LiveEventInputProtocol pointing to the current value. -func (c LiveEventInputProtocol) ToPtr() *LiveEventInputProtocol { - return &c -} - // LiveEventResourceState - The resource state of the live event. See https://go.microsoft.com/fwlink/?linkid=2139012 for // more information. type LiveEventResourceState string @@ -1261,11 +1066,6 @@ func PossibleLiveEventResourceStateValues() []LiveEventResourceState { } } -// ToPtr returns a *LiveEventResourceState pointing to the current value. -func (c LiveEventResourceState) ToPtr() *LiveEventResourceState { - return &c -} - // LiveOutputResourceState - The resource state of the live output. type LiveOutputResourceState string @@ -1290,11 +1090,6 @@ func PossibleLiveOutputResourceStateValues() []LiveOutputResourceState { } } -// ToPtr returns a *LiveOutputResourceState pointing to the current value. -func (c LiveOutputResourceState) ToPtr() *LiveOutputResourceState { - return &c -} - // MetricAggregationType - The metric aggregation type type MetricAggregationType string @@ -1316,11 +1111,6 @@ func PossibleMetricAggregationTypeValues() []MetricAggregationType { } } -// ToPtr returns a *MetricAggregationType pointing to the current value. -func (c MetricAggregationType) ToPtr() *MetricAggregationType { - return &c -} - // MetricUnit - The metric unit type MetricUnit string @@ -1342,11 +1132,6 @@ func PossibleMetricUnitValues() []MetricUnit { } } -// ToPtr returns a *MetricUnit pointing to the current value. -func (c MetricUnit) ToPtr() *MetricUnit { - return &c -} - // OnErrorType - A Transform can define more than one outputs. This property defines what the service should do when one output // fails - either continue to produce other outputs, or, stop the other outputs. The overall // Job state will not reflect failures of outputs that are specified with 'ContinueJob'. The default is 'StopProcessingJob'. @@ -1369,11 +1154,6 @@ func PossibleOnErrorTypeValues() []OnErrorType { } } -// ToPtr returns a *OnErrorType pointing to the current value. -func (c OnErrorType) ToPtr() *OnErrorType { - return &c -} - // Priority - Sets the relative priority of the TransformOutputs within a Transform. This sets the priority that the service // uses for processing TransformOutputs. The default priority is Normal. type Priority string @@ -1396,11 +1176,6 @@ func PossiblePriorityValues() []Priority { } } -// ToPtr returns a *Priority pointing to the current value. -func (c Priority) ToPtr() *Priority { - return &c -} - // PrivateEndpointConnectionProvisioningState - The current provisioning state. type PrivateEndpointConnectionProvisioningState string @@ -1421,11 +1196,6 @@ func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpoin } } -// ToPtr returns a *PrivateEndpointConnectionProvisioningState pointing to the current value. -func (c PrivateEndpointConnectionProvisioningState) ToPtr() *PrivateEndpointConnectionProvisioningState { - return &c -} - // PrivateEndpointServiceConnectionStatus - The private endpoint connection status. type PrivateEndpointServiceConnectionStatus string @@ -1444,11 +1214,6 @@ func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointSer } } -// ToPtr returns a *PrivateEndpointServiceConnectionStatus pointing to the current value. -func (c PrivateEndpointServiceConnectionStatus) ToPtr() *PrivateEndpointServiceConnectionStatus { - return &c -} - // ProvisioningState - Provisioning state of the asset track. type ProvisioningState string @@ -1470,11 +1235,6 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// ToPtr returns a *ProvisioningState pointing to the current value. -func (c ProvisioningState) ToPtr() *ProvisioningState { - return &c -} - // PublicNetworkAccess - Whether or not public network access is allowed for resources under the Media Services account. type PublicNetworkAccess string @@ -1493,11 +1253,6 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { } } -// ToPtr returns a *PublicNetworkAccess pointing to the current value. -func (c PublicNetworkAccess) ToPtr() *PublicNetworkAccess { - return &c -} - // Rotation - The rotation, if any, to be applied to the input video, before it is encoded. Default is Auto type Rotation string @@ -1528,11 +1283,6 @@ func PossibleRotationValues() []Rotation { } } -// ToPtr returns a *Rotation pointing to the current value. -func (c Rotation) ToPtr() *Rotation { - return &c -} - // StorageAccountType - The type of the storage account. type StorageAccountType string @@ -1551,11 +1301,6 @@ func PossibleStorageAccountTypeValues() []StorageAccountType { } } -// ToPtr returns a *StorageAccountType pointing to the current value. -func (c StorageAccountType) ToPtr() *StorageAccountType { - return &c -} - type StorageAuthentication string const ( @@ -1573,11 +1318,6 @@ func PossibleStorageAuthenticationValues() []StorageAuthentication { } } -// ToPtr returns a *StorageAuthentication pointing to the current value. -func (c StorageAuthentication) ToPtr() *StorageAuthentication { - return &c -} - type StreamOptionsFlag string const ( @@ -1600,11 +1340,6 @@ func PossibleStreamOptionsFlagValues() []StreamOptionsFlag { } } -// ToPtr returns a *StreamOptionsFlag pointing to the current value. -func (c StreamOptionsFlag) ToPtr() *StreamOptionsFlag { - return &c -} - // StreamingEndpointResourceState - The resource state of the streaming endpoint. type StreamingEndpointResourceState string @@ -1636,11 +1371,6 @@ func PossibleStreamingEndpointResourceStateValues() []StreamingEndpointResourceS } } -// ToPtr returns a *StreamingEndpointResourceState pointing to the current value. -func (c StreamingEndpointResourceState) ToPtr() *StreamingEndpointResourceState { - return &c -} - // StreamingLocatorContentKeyType - Encryption type of Content Key type StreamingLocatorContentKeyType string @@ -1662,11 +1392,6 @@ func PossibleStreamingLocatorContentKeyTypeValues() []StreamingLocatorContentKey } } -// ToPtr returns a *StreamingLocatorContentKeyType pointing to the current value. -func (c StreamingLocatorContentKeyType) ToPtr() *StreamingLocatorContentKeyType { - return &c -} - // StreamingPolicyStreamingProtocol - Streaming protocol type StreamingPolicyStreamingProtocol string @@ -1691,11 +1416,6 @@ func PossibleStreamingPolicyStreamingProtocolValues() []StreamingPolicyStreaming } } -// ToPtr returns a *StreamingPolicyStreamingProtocol pointing to the current value. -func (c StreamingPolicyStreamingProtocol) ToPtr() *StreamingPolicyStreamingProtocol { - return &c -} - // StretchMode - The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default // is AutoSize type StretchMode string @@ -1724,11 +1444,6 @@ func PossibleStretchModeValues() []StretchMode { } } -// ToPtr returns a *StretchMode pointing to the current value. -func (c StretchMode) ToPtr() *StretchMode { - return &c -} - // TrackAttribute - The TrackAttribute to filter the tracks by. type TrackAttribute string @@ -1747,11 +1462,6 @@ func PossibleTrackAttributeValues() []TrackAttribute { } } -// ToPtr returns a *TrackAttribute pointing to the current value. -func (c TrackAttribute) ToPtr() *TrackAttribute { - return &c -} - // TrackPropertyCompareOperation - Track property condition operation type TrackPropertyCompareOperation string @@ -1770,11 +1480,6 @@ func PossibleTrackPropertyCompareOperationValues() []TrackPropertyCompareOperati } } -// ToPtr returns a *TrackPropertyCompareOperation pointing to the current value. -func (c TrackPropertyCompareOperation) ToPtr() *TrackPropertyCompareOperation { - return &c -} - // TrackPropertyType - Track property type type TrackPropertyType string @@ -1793,11 +1498,6 @@ func PossibleTrackPropertyTypeValues() []TrackPropertyType { } } -// ToPtr returns a *TrackPropertyType pointing to the current value. -func (c TrackPropertyType) ToPtr() *TrackPropertyType { - return &c -} - // VideoSyncMode - The Video Sync Mode type VideoSyncMode string @@ -1830,11 +1530,6 @@ func PossibleVideoSyncModeValues() []VideoSyncMode { } } -// ToPtr returns a *VideoSyncMode pointing to the current value. -func (c VideoSyncMode) ToPtr() *VideoSyncMode { - return &c -} - // Visibility - When PlayerVisibility is set to "Visible", the text track will be present in the DASH manifest or HLS playlist // when requested by a client. When the PlayerVisibility is set to "Hidden", the text will // not be available to the client. The default value is "Visible". @@ -1854,8 +1549,3 @@ func PossibleVisibilityValues() []Visibility { VisibilityVisible, } } - -// ToPtr returns a *Visibility pointing to the current value. -func (c Visibility) ToPtr() *Visibility { - return &c -} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_contentkeypolicies_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_contentkeypolicies_client.go index 813541647a4f..5aaf43525822 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_contentkeypolicies_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_contentkeypolicies_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type ContentKeyPoliciesClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewContentKeyPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ContentKeyPoliciesClient { +func NewContentKeyPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContentKeyPoliciesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ContentKeyPoliciesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Create or update a Content Key Policy in the Media Services account @@ -105,7 +110,7 @@ func (client *ContentKeyPoliciesClient) createOrUpdateCreateRequest(ctx context. // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *ContentKeyPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ContentKeyPoliciesClientCreateOrUpdateResponse, error) { - result := ContentKeyPoliciesClientCreateOrUpdateResponse{RawResponse: resp} + result := ContentKeyPoliciesClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicy); err != nil { return ContentKeyPoliciesClientCreateOrUpdateResponse{}, err } @@ -131,7 +136,7 @@ func (client *ContentKeyPoliciesClient) Delete(ctx context.Context, resourceGrou if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return ContentKeyPoliciesClientDeleteResponse{}, runtime.NewResponseError(resp) } - return ContentKeyPoliciesClientDeleteResponse{RawResponse: resp}, nil + return ContentKeyPoliciesClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -217,7 +222,7 @@ func (client *ContentKeyPoliciesClient) getCreateRequest(ctx context.Context, re // getHandleResponse handles the Get response. func (client *ContentKeyPoliciesClient) getHandleResponse(resp *http.Response) (ContentKeyPoliciesClientGetResponse, error) { - result := ContentKeyPoliciesClientGetResponse{RawResponse: resp} + result := ContentKeyPoliciesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicy); err != nil { return ContentKeyPoliciesClientGetResponse{}, err } @@ -278,7 +283,7 @@ func (client *ContentKeyPoliciesClient) getPolicyPropertiesWithSecretsCreateRequ // getPolicyPropertiesWithSecretsHandleResponse handles the GetPolicyPropertiesWithSecrets response. func (client *ContentKeyPoliciesClient) getPolicyPropertiesWithSecretsHandleResponse(resp *http.Response) (ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResponse, error) { - result := ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResponse{RawResponse: resp} + result := ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicyProperties); err != nil { return ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResponse{}, err } @@ -290,16 +295,32 @@ func (client *ContentKeyPoliciesClient) getPolicyPropertiesWithSecretsHandleResp // resourceGroupName - The name of the resource group within the Azure subscription. // accountName - The Media Services account name. // options - ContentKeyPoliciesClientListOptions contains the optional parameters for the ContentKeyPoliciesClient.List method. -func (client *ContentKeyPoliciesClient) List(resourceGroupName string, accountName string, options *ContentKeyPoliciesClientListOptions) *ContentKeyPoliciesClientListPager { - return &ContentKeyPoliciesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *ContentKeyPoliciesClient) List(resourceGroupName string, accountName string, options *ContentKeyPoliciesClientListOptions) *runtime.Pager[ContentKeyPoliciesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ContentKeyPoliciesClientListResponse]{ + More: func(page ContentKeyPoliciesClientListResponse) bool { + return page.ODataNextLink != nil && len(*page.ODataNextLink) > 0 }, - advancer: func(ctx context.Context, resp ContentKeyPoliciesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ContentKeyPolicyCollection.ODataNextLink) + Fetcher: func(ctx context.Context, page *ContentKeyPoliciesClientListResponse) (ContentKeyPoliciesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink) + } + if err != nil { + return ContentKeyPoliciesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContentKeyPoliciesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContentKeyPoliciesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -339,7 +360,7 @@ func (client *ContentKeyPoliciesClient) listCreateRequest(ctx context.Context, r // listHandleResponse handles the List response. func (client *ContentKeyPoliciesClient) listHandleResponse(resp *http.Response) (ContentKeyPoliciesClientListResponse, error) { - result := ContentKeyPoliciesClientListResponse{RawResponse: resp} + result := ContentKeyPoliciesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicyCollection); err != nil { return ContentKeyPoliciesClientListResponse{}, err } @@ -401,7 +422,7 @@ func (client *ContentKeyPoliciesClient) updateCreateRequest(ctx context.Context, // updateHandleResponse handles the Update response. func (client *ContentKeyPoliciesClient) updateHandleResponse(resp *http.Response) (ContentKeyPoliciesClientUpdateResponse, error) { - result := ContentKeyPoliciesClientUpdateResponse{RawResponse: resp} + result := ContentKeyPoliciesClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicy); err != nil { return ContentKeyPoliciesClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_jobs_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_jobs_client.go index 8909ddd66fdc..94d3f0ed5dcd 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_jobs_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_jobs_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type JobsClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobsClient { +func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &JobsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CancelJob - Cancel a Job. @@ -68,7 +73,7 @@ func (client *JobsClient) CancelJob(ctx context.Context, resourceGroupName strin if !runtime.HasStatusCode(resp, http.StatusOK) { return JobsClientCancelJobResponse{}, runtime.NewResponseError(resp) } - return JobsClientCancelJobResponse{RawResponse: resp}, nil + return JobsClientCancelJobResponse{}, nil } // cancelJobCreateRequest creates the CancelJob request. @@ -164,7 +169,7 @@ func (client *JobsClient) createCreateRequest(ctx context.Context, resourceGroup // createHandleResponse handles the Create response. func (client *JobsClient) createHandleResponse(resp *http.Response) (JobsClientCreateResponse, error) { - result := JobsClientCreateResponse{RawResponse: resp} + result := JobsClientCreateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { return JobsClientCreateResponse{}, err } @@ -190,7 +195,7 @@ func (client *JobsClient) Delete(ctx context.Context, resourceGroupName string, if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return JobsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return JobsClientDeleteResponse{RawResponse: resp}, nil + return JobsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -285,7 +290,7 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupNam // getHandleResponse handles the Get response. func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsClientGetResponse, error) { - result := JobsClientGetResponse{RawResponse: resp} + result := JobsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { return JobsClientGetResponse{}, err } @@ -298,16 +303,32 @@ func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsClientGetR // accountName - The Media Services account name. // transformName - The Transform name. // options - JobsClientListOptions contains the optional parameters for the JobsClient.List method. -func (client *JobsClient) List(resourceGroupName string, accountName string, transformName string, options *JobsClientListOptions) *JobsClientListPager { - return &JobsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, transformName, options) +func (client *JobsClient) List(resourceGroupName string, accountName string, transformName string, options *JobsClientListOptions) *runtime.Pager[JobsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[JobsClientListResponse]{ + More: func(page JobsClientListResponse) bool { + return page.ODataNextLink != nil && len(*page.ODataNextLink) > 0 }, - advancer: func(ctx context.Context, resp JobsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.JobCollection.ODataNextLink) + Fetcher: func(ctx context.Context, page *JobsClientListResponse) (JobsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, transformName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink) + } + if err != nil { + return JobsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return JobsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -348,7 +369,7 @@ func (client *JobsClient) listCreateRequest(ctx context.Context, resourceGroupNa // listHandleResponse handles the List response. func (client *JobsClient) listHandleResponse(resp *http.Response) (JobsClientListResponse, error) { - result := JobsClientListResponse{RawResponse: resp} + result := JobsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.JobCollection); err != nil { return JobsClientListResponse{}, err } @@ -415,7 +436,7 @@ func (client *JobsClient) updateCreateRequest(ctx context.Context, resourceGroup // updateHandleResponse handles the Update response. func (client *JobsClient) updateHandleResponse(resp *http.Response) (JobsClientUpdateResponse, error) { - result := JobsClientUpdateResponse{RawResponse: resp} + result := JobsClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { return JobsClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveevents_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveevents_client.go index 58a8bb9e1702..31509fbd48df 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveevents_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveevents_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type LiveEventsClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewLiveEventsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LiveEventsClient { +func NewLiveEventsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LiveEventsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &LiveEventsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // BeginAllocate - A live event is in StandBy state after allocation completes, and is ready to start. @@ -57,22 +62,16 @@ func NewLiveEventsClient(subscriptionID string, credential azcore.TokenCredentia // liveEventName - The name of the live event, maximum length is 32. // options - LiveEventsClientBeginAllocateOptions contains the optional parameters for the LiveEventsClient.BeginAllocate // method. -func (client *LiveEventsClient) BeginAllocate(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsClientBeginAllocateOptions) (LiveEventsClientAllocatePollerResponse, error) { - resp, err := client.allocate(ctx, resourceGroupName, accountName, liveEventName, options) - if err != nil { - return LiveEventsClientAllocatePollerResponse{}, err - } - result := LiveEventsClientAllocatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("LiveEventsClient.Allocate", "", resp, client.pl) - if err != nil { - return LiveEventsClientAllocatePollerResponse{}, err - } - result.Poller = &LiveEventsClientAllocatePoller{ - pt: pt, +func (client *LiveEventsClient) BeginAllocate(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsClientBeginAllocateOptions) (*armruntime.Poller[LiveEventsClientAllocateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.allocate(ctx, resourceGroupName, accountName, liveEventName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[LiveEventsClientAllocateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[LiveEventsClientAllocateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Allocate - A live event is in StandBy state after allocation completes, and is ready to start. @@ -129,22 +128,16 @@ func (client *LiveEventsClient) allocateCreateRequest(ctx context.Context, resou // liveEventName - The name of the live event, maximum length is 32. // parameters - Live event properties needed for creation. // options - LiveEventsClientBeginCreateOptions contains the optional parameters for the LiveEventsClient.BeginCreate method. -func (client *LiveEventsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEvent, options *LiveEventsClientBeginCreateOptions) (LiveEventsClientCreatePollerResponse, error) { - resp, err := client.create(ctx, resourceGroupName, accountName, liveEventName, parameters, options) - if err != nil { - return LiveEventsClientCreatePollerResponse{}, err - } - result := LiveEventsClientCreatePollerResponse{ - RawResponse: resp, +func (client *LiveEventsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEvent, options *LiveEventsClientBeginCreateOptions) (*armruntime.Poller[LiveEventsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, accountName, liveEventName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[LiveEventsClientCreateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[LiveEventsClientCreateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("LiveEventsClient.Create", "", resp, client.pl) - if err != nil { - return LiveEventsClientCreatePollerResponse{}, err - } - result.Poller = &LiveEventsClientCreatePoller{ - pt: pt, - } - return result, nil } // Create - Creates a new live event. @@ -203,22 +196,16 @@ func (client *LiveEventsClient) createCreateRequest(ctx context.Context, resourc // accountName - The Media Services account name. // liveEventName - The name of the live event, maximum length is 32. // options - LiveEventsClientBeginDeleteOptions contains the optional parameters for the LiveEventsClient.BeginDelete method. -func (client *LiveEventsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsClientBeginDeleteOptions) (LiveEventsClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, liveEventName, options) - if err != nil { - return LiveEventsClientDeletePollerResponse{}, err - } - result := LiveEventsClientDeletePollerResponse{ - RawResponse: resp, +func (client *LiveEventsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsClientBeginDeleteOptions) (*armruntime.Poller[LiveEventsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, liveEventName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[LiveEventsClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[LiveEventsClientDeleteResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("LiveEventsClient.Delete", "", resp, client.pl) - if err != nil { - return LiveEventsClientDeletePollerResponse{}, err - } - result.Poller = &LiveEventsClientDeletePoller{ - pt: pt, - } - return result, nil } // Delete - Deletes a live event. @@ -321,7 +308,7 @@ func (client *LiveEventsClient) getCreateRequest(ctx context.Context, resourceGr // getHandleResponse handles the Get response. func (client *LiveEventsClient) getHandleResponse(resp *http.Response) (LiveEventsClientGetResponse, error) { - result := LiveEventsClientGetResponse{RawResponse: resp} + result := LiveEventsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.LiveEvent); err != nil { return LiveEventsClientGetResponse{}, err } @@ -333,16 +320,32 @@ func (client *LiveEventsClient) getHandleResponse(resp *http.Response) (LiveEven // resourceGroupName - The name of the resource group within the Azure subscription. // accountName - The Media Services account name. // options - LiveEventsClientListOptions contains the optional parameters for the LiveEventsClient.List method. -func (client *LiveEventsClient) List(resourceGroupName string, accountName string, options *LiveEventsClientListOptions) *LiveEventsClientListPager { - return &LiveEventsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *LiveEventsClient) List(resourceGroupName string, accountName string, options *LiveEventsClientListOptions) *runtime.Pager[LiveEventsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[LiveEventsClientListResponse]{ + More: func(page LiveEventsClientListResponse) bool { + return page.ODataNextLink != nil && len(*page.ODataNextLink) > 0 }, - advancer: func(ctx context.Context, resp LiveEventsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.LiveEventListResult.ODataNextLink) + Fetcher: func(ctx context.Context, page *LiveEventsClientListResponse) (LiveEventsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink) + } + if err != nil { + return LiveEventsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LiveEventsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LiveEventsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -373,7 +376,7 @@ func (client *LiveEventsClient) listCreateRequest(ctx context.Context, resourceG // listHandleResponse handles the List response. func (client *LiveEventsClient) listHandleResponse(resp *http.Response) (LiveEventsClientListResponse, error) { - result := LiveEventsClientListResponse{RawResponse: resp} + result := LiveEventsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.LiveEventListResult); err != nil { return LiveEventsClientListResponse{}, err } @@ -388,22 +391,16 @@ func (client *LiveEventsClient) listHandleResponse(resp *http.Response) (LiveEve // accountName - The Media Services account name. // liveEventName - The name of the live event, maximum length is 32. // options - LiveEventsClientBeginResetOptions contains the optional parameters for the LiveEventsClient.BeginReset method. -func (client *LiveEventsClient) BeginReset(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsClientBeginResetOptions) (LiveEventsClientResetPollerResponse, error) { - resp, err := client.reset(ctx, resourceGroupName, accountName, liveEventName, options) - if err != nil { - return LiveEventsClientResetPollerResponse{}, err +func (client *LiveEventsClient) BeginReset(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsClientBeginResetOptions) (*armruntime.Poller[LiveEventsClientResetResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reset(ctx, resourceGroupName, accountName, liveEventName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[LiveEventsClientResetResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[LiveEventsClientResetResponse](options.ResumeToken, client.pl, nil) } - result := LiveEventsClientResetPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("LiveEventsClient.Reset", "", resp, client.pl) - if err != nil { - return LiveEventsClientResetPollerResponse{}, err - } - result.Poller = &LiveEventsClientResetPoller{ - pt: pt, - } - return result, nil } // Reset - Resets an existing live event. All live outputs for the live event are deleted and the live event is stopped and @@ -461,22 +458,16 @@ func (client *LiveEventsClient) resetCreateRequest(ctx context.Context, resource // accountName - The Media Services account name. // liveEventName - The name of the live event, maximum length is 32. // options - LiveEventsClientBeginStartOptions contains the optional parameters for the LiveEventsClient.BeginStart method. -func (client *LiveEventsClient) BeginStart(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsClientBeginStartOptions) (LiveEventsClientStartPollerResponse, error) { - resp, err := client.start(ctx, resourceGroupName, accountName, liveEventName, options) - if err != nil { - return LiveEventsClientStartPollerResponse{}, err +func (client *LiveEventsClient) BeginStart(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsClientBeginStartOptions) (*armruntime.Poller[LiveEventsClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, accountName, liveEventName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[LiveEventsClientStartResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[LiveEventsClientStartResponse](options.ResumeToken, client.pl, nil) } - result := LiveEventsClientStartPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("LiveEventsClient.Start", "", resp, client.pl) - if err != nil { - return LiveEventsClientStartPollerResponse{}, err - } - result.Poller = &LiveEventsClientStartPoller{ - pt: pt, - } - return result, nil } // Start - A live event in Stopped or StandBy state will be in Running state after the start operation completes. @@ -533,22 +524,16 @@ func (client *LiveEventsClient) startCreateRequest(ctx context.Context, resource // liveEventName - The name of the live event, maximum length is 32. // parameters - LiveEvent stop parameters // options - LiveEventsClientBeginStopOptions contains the optional parameters for the LiveEventsClient.BeginStop method. -func (client *LiveEventsClient) BeginStop(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEventActionInput, options *LiveEventsClientBeginStopOptions) (LiveEventsClientStopPollerResponse, error) { - resp, err := client.stop(ctx, resourceGroupName, accountName, liveEventName, parameters, options) - if err != nil { - return LiveEventsClientStopPollerResponse{}, err +func (client *LiveEventsClient) BeginStop(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEventActionInput, options *LiveEventsClientBeginStopOptions) (*armruntime.Poller[LiveEventsClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, accountName, liveEventName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[LiveEventsClientStopResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[LiveEventsClientStopResponse](options.ResumeToken, client.pl, nil) } - result := LiveEventsClientStopPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("LiveEventsClient.Stop", "", resp, client.pl) - if err != nil { - return LiveEventsClientStopPollerResponse{}, err - } - result.Poller = &LiveEventsClientStopPoller{ - pt: pt, - } - return result, nil } // Stop - Stops a running live event. @@ -605,22 +590,16 @@ func (client *LiveEventsClient) stopCreateRequest(ctx context.Context, resourceG // liveEventName - The name of the live event, maximum length is 32. // parameters - Live event properties needed for patch. // options - LiveEventsClientBeginUpdateOptions contains the optional parameters for the LiveEventsClient.BeginUpdate method. -func (client *LiveEventsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEvent, options *LiveEventsClientBeginUpdateOptions) (LiveEventsClientUpdatePollerResponse, error) { - resp, err := client.update(ctx, resourceGroupName, accountName, liveEventName, parameters, options) - if err != nil { - return LiveEventsClientUpdatePollerResponse{}, err +func (client *LiveEventsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEvent, options *LiveEventsClientBeginUpdateOptions) (*armruntime.Poller[LiveEventsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, liveEventName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[LiveEventsClientUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[LiveEventsClientUpdateResponse](options.ResumeToken, client.pl, nil) } - result := LiveEventsClientUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("LiveEventsClient.Update", "", resp, client.pl) - if err != nil { - return LiveEventsClientUpdatePollerResponse{}, err - } - result.Poller = &LiveEventsClientUpdatePoller{ - pt: pt, - } - return result, nil } // Update - Updates settings on an existing live event. diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveoutputs_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveoutputs_client.go index 0548649b434c..2e43f2ea90f8 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveoutputs_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveoutputs_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type LiveOutputsClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewLiveOutputsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LiveOutputsClient { +func NewLiveOutputsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LiveOutputsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &LiveOutputsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreate - Creates a new live output. @@ -57,22 +62,16 @@ func NewLiveOutputsClient(subscriptionID string, credential azcore.TokenCredenti // liveOutputName - The name of the live output. // parameters - Live Output properties needed for creation. // options - LiveOutputsClientBeginCreateOptions contains the optional parameters for the LiveOutputsClient.BeginCreate method. -func (client *LiveOutputsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, parameters LiveOutput, options *LiveOutputsClientBeginCreateOptions) (LiveOutputsClientCreatePollerResponse, error) { - resp, err := client.create(ctx, resourceGroupName, accountName, liveEventName, liveOutputName, parameters, options) - if err != nil { - return LiveOutputsClientCreatePollerResponse{}, err - } - result := LiveOutputsClientCreatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("LiveOutputsClient.Create", "", resp, client.pl) - if err != nil { - return LiveOutputsClientCreatePollerResponse{}, err - } - result.Poller = &LiveOutputsClientCreatePoller{ - pt: pt, +func (client *LiveOutputsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, parameters LiveOutput, options *LiveOutputsClientBeginCreateOptions) (*armruntime.Poller[LiveOutputsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, accountName, liveEventName, liveOutputName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[LiveOutputsClientCreateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[LiveOutputsClientCreateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Create - Creates a new live output. @@ -133,22 +132,16 @@ func (client *LiveOutputsClient) createCreateRequest(ctx context.Context, resour // liveEventName - The name of the live event, maximum length is 32. // liveOutputName - The name of the live output. // options - LiveOutputsClientBeginDeleteOptions contains the optional parameters for the LiveOutputsClient.BeginDelete method. -func (client *LiveOutputsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, options *LiveOutputsClientBeginDeleteOptions) (LiveOutputsClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, liveEventName, liveOutputName, options) - if err != nil { - return LiveOutputsClientDeletePollerResponse{}, err - } - result := LiveOutputsClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("LiveOutputsClient.Delete", "", resp, client.pl) - if err != nil { - return LiveOutputsClientDeletePollerResponse{}, err - } - result.Poller = &LiveOutputsClientDeletePoller{ - pt: pt, +func (client *LiveOutputsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, options *LiveOutputsClientBeginDeleteOptions) (*armruntime.Poller[LiveOutputsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, liveEventName, liveOutputName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[LiveOutputsClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[LiveOutputsClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - Deletes a live output. Deleting a live output does not delete the asset the live output is writing to. @@ -260,7 +253,7 @@ func (client *LiveOutputsClient) getCreateRequest(ctx context.Context, resourceG // getHandleResponse handles the Get response. func (client *LiveOutputsClient) getHandleResponse(resp *http.Response) (LiveOutputsClientGetResponse, error) { - result := LiveOutputsClientGetResponse{RawResponse: resp} + result := LiveOutputsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.LiveOutput); err != nil { return LiveOutputsClientGetResponse{}, err } @@ -273,16 +266,32 @@ func (client *LiveOutputsClient) getHandleResponse(resp *http.Response) (LiveOut // accountName - The Media Services account name. // liveEventName - The name of the live event, maximum length is 32. // options - LiveOutputsClientListOptions contains the optional parameters for the LiveOutputsClient.List method. -func (client *LiveOutputsClient) List(resourceGroupName string, accountName string, liveEventName string, options *LiveOutputsClientListOptions) *LiveOutputsClientListPager { - return &LiveOutputsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, liveEventName, options) +func (client *LiveOutputsClient) List(resourceGroupName string, accountName string, liveEventName string, options *LiveOutputsClientListOptions) *runtime.Pager[LiveOutputsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[LiveOutputsClientListResponse]{ + More: func(page LiveOutputsClientListResponse) bool { + return page.ODataNextLink != nil && len(*page.ODataNextLink) > 0 }, - advancer: func(ctx context.Context, resp LiveOutputsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.LiveOutputListResult.ODataNextLink) + Fetcher: func(ctx context.Context, page *LiveOutputsClientListResponse) (LiveOutputsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, liveEventName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink) + } + if err != nil { + return LiveOutputsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LiveOutputsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LiveOutputsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -317,7 +326,7 @@ func (client *LiveOutputsClient) listCreateRequest(ctx context.Context, resource // listHandleResponse handles the List response. func (client *LiveOutputsClient) listHandleResponse(resp *http.Response) (LiveOutputsClientListResponse, error) { - result := LiveOutputsClientListResponse{RawResponse: resp} + result := LiveOutputsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.LiveOutputListResult); err != nil { return LiveOutputsClientListResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_locations_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_locations_client.go index 676bed006d0e..95b94819bbcc 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_locations_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_locations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type LocationsClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationsClient { +func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &LocationsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CheckNameAvailability - Checks whether the Media Service resource name is available. @@ -94,7 +99,7 @@ func (client *LocationsClient) checkNameAvailabilityCreateRequest(ctx context.Co // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. func (client *LocationsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (LocationsClientCheckNameAvailabilityResponse, error) { - result := LocationsClientCheckNameAvailabilityResponse{RawResponse: resp} + result := LocationsClientCheckNameAvailabilityResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.EntityNameAvailabilityCheckOutput); err != nil { return LocationsClientCheckNameAvailabilityResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models.go index fd5a2eadcbfc..93c592f638cf 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,13 +8,7 @@ package armmediaservices -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "reflect" - "time" -) +import "time" // AacAudio - Describes Advanced Audio Codec (AAC) audio encoding settings. type AacAudio struct { @@ -37,72 +31,6 @@ type AacAudio struct { SamplingRate *int32 `json:"samplingRate,omitempty"` } -// GetAudio implements the AudioClassification interface for type AacAudio. -func (a *AacAudio) GetAudio() *Audio { - return &Audio{ - Channels: a.Channels, - SamplingRate: a.SamplingRate, - Bitrate: a.Bitrate, - ODataType: a.ODataType, - Label: a.Label, - } -} - -// GetCodec implements the CodecClassification interface for type AacAudio. -func (a *AacAudio) GetCodec() *Codec { - return &Codec{ - ODataType: a.ODataType, - Label: a.Label, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AacAudio. -func (a AacAudio) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "bitrate", a.Bitrate) - populate(objectMap, "channels", a.Channels) - populate(objectMap, "label", a.Label) - objectMap["@odata.type"] = "#Microsoft.Media.AacAudio" - populate(objectMap, "profile", a.Profile) - populate(objectMap, "samplingRate", a.SamplingRate) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AacAudio. -func (a *AacAudio) 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 "bitrate": - err = unpopulate(val, &a.Bitrate) - delete(rawMsg, key) - case "channels": - err = unpopulate(val, &a.Channels) - delete(rawMsg, key) - case "label": - err = unpopulate(val, &a.Label) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &a.ODataType) - delete(rawMsg, key) - case "profile": - err = unpopulate(val, &a.Profile) - delete(rawMsg, key) - case "samplingRate": - err = unpopulate(val, &a.SamplingRate) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AbsoluteClipTime - Specifies the clip time as an absolute time position in the media file. The absolute time can point // to a different position depending on whether the media file starts from a timestamp of zero or not. type AbsoluteClipTime struct { @@ -114,44 +42,6 @@ type AbsoluteClipTime struct { Time *string `json:"time,omitempty"` } -// GetClipTime implements the ClipTimeClassification interface for type AbsoluteClipTime. -func (a *AbsoluteClipTime) GetClipTime() *ClipTime { - return &ClipTime{ - ODataType: a.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AbsoluteClipTime. -func (a AbsoluteClipTime) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["@odata.type"] = "#Microsoft.Media.AbsoluteClipTime" - populate(objectMap, "time", a.Time) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AbsoluteClipTime. -func (a *AbsoluteClipTime) 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 "@odata.type": - err = unpopulate(val, &a.ODataType) - delete(rawMsg, key) - case "time": - err = unpopulate(val, &a.Time) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - type AccessControl struct { // The behavior for IP access control in Key Delivery. DefaultAction *DefaultAction `json:"defaultAction,omitempty"` @@ -161,14 +51,6 @@ type AccessControl struct { IPAllowList []*string `json:"ipAllowList,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AccessControl. -func (a AccessControl) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "defaultAction", a.DefaultAction) - populate(objectMap, "ipAllowList", a.IPAllowList) - return json.Marshal(objectMap) -} - type AccountEncryption struct { // REQUIRED; The type of key used to encrypt the Account Key. Type *AccountEncryptionKeyType `json:"type,omitempty"` @@ -201,17 +83,6 @@ type AccountFilter struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AccountFilter. -func (a AccountFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - // AccountFilterCollection - A collection of AccountFilter items. type AccountFilterCollection struct { // A link to the next page of the collection (when the collection contains too many results to return in one response). @@ -221,14 +92,6 @@ type AccountFilterCollection struct { Value []*AccountFilter `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AccountFilterCollection. -func (a AccountFilterCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@odata.nextLink", a.ODataNextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - // AccountFiltersClientCreateOrUpdateOptions contains the optional parameters for the AccountFiltersClient.CreateOrUpdate // method. type AccountFiltersClientCreateOrUpdateOptions struct { @@ -261,13 +124,6 @@ type AkamaiAccessControl struct { AkamaiSignatureHeaderAuthenticationKeyList []*AkamaiSignatureHeaderAuthenticationKey `json:"akamaiSignatureHeaderAuthenticationKeyList,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AkamaiAccessControl. -func (a AkamaiAccessControl) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "akamaiSignatureHeaderAuthenticationKeyList", a.AkamaiSignatureHeaderAuthenticationKeyList) - return json.Marshal(objectMap) -} - // AkamaiSignatureHeaderAuthenticationKey - Akamai Signature Header authentication key. type AkamaiSignatureHeaderAuthenticationKey struct { // authentication key @@ -280,41 +136,6 @@ type AkamaiSignatureHeaderAuthenticationKey struct { Identifier *string `json:"identifier,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AkamaiSignatureHeaderAuthenticationKey. -func (a AkamaiSignatureHeaderAuthenticationKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "base64Key", a.Base64Key) - populateTimeRFC3339(objectMap, "expiration", a.Expiration) - populate(objectMap, "identifier", a.Identifier) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AkamaiSignatureHeaderAuthenticationKey. -func (a *AkamaiSignatureHeaderAuthenticationKey) 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 "base64Key": - err = unpopulate(val, &a.Base64Key) - delete(rawMsg, key) - case "expiration": - err = unpopulateTimeRFC3339(val, &a.Expiration) - delete(rawMsg, key) - case "identifier": - err = unpopulate(val, &a.Identifier) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ArmStreamingEndpointCapacity - The streaming endpoint sku capacity. type ArmStreamingEndpointCapacity struct { // The streaming endpoint default capacity. @@ -372,17 +193,6 @@ type Asset struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Asset. -func (a Asset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - // AssetCollection - A collection of Asset items. type AssetCollection struct { // A link to the next page of the collection (when the collection contains too many results to return in one response). @@ -392,27 +202,12 @@ type AssetCollection struct { Value []*Asset `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AssetCollection. -func (a AssetCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@odata.nextLink", a.ODataNextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - // AssetContainerSas - The Asset Storage container SAS URLs. type AssetContainerSas struct { // The list of Asset container SAS URLs. AssetContainerSasUrls []*string `json:"assetContainerSasUrls,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AssetContainerSas. -func (a AssetContainerSas) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assetContainerSasUrls", a.AssetContainerSasUrls) - return json.Marshal(objectMap) -} - // AssetFileEncryptionMetadata - The Asset File Storage encryption metadata. type AssetFileEncryptionMetadata struct { // REQUIRED; The Asset File Id. @@ -443,17 +238,6 @@ type AssetFilter struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AssetFilter. -func (a AssetFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - // AssetFilterCollection - A collection of AssetFilter items. type AssetFilterCollection struct { // A link to the next page of the collection (when the collection contains too many results to return in one response). @@ -463,14 +247,6 @@ type AssetFilterCollection struct { Value []*AssetFilter `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AssetFilterCollection. -func (a AssetFilterCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@odata.nextLink", a.ODataNextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - // AssetFiltersClientCreateOrUpdateOptions contains the optional parameters for the AssetFiltersClient.CreateOrUpdate method. type AssetFiltersClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -523,61 +299,6 @@ type AssetProperties struct { StorageEncryptionFormat *AssetStorageEncryptionFormat `json:"storageEncryptionFormat,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AssetProperties. -func (a AssetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alternateId", a.AlternateID) - populate(objectMap, "assetId", a.AssetID) - populate(objectMap, "container", a.Container) - populateTimeRFC3339(objectMap, "created", a.Created) - populate(objectMap, "description", a.Description) - populateTimeRFC3339(objectMap, "lastModified", a.LastModified) - populate(objectMap, "storageAccountName", a.StorageAccountName) - populate(objectMap, "storageEncryptionFormat", a.StorageEncryptionFormat) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssetProperties. -func (a *AssetProperties) 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 "alternateId": - err = unpopulate(val, &a.AlternateID) - delete(rawMsg, key) - case "assetId": - err = unpopulate(val, &a.AssetID) - delete(rawMsg, key) - case "container": - err = unpopulate(val, &a.Container) - delete(rawMsg, key) - case "created": - err = unpopulateTimeRFC3339(val, &a.Created) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &a.Description) - delete(rawMsg, key) - case "lastModified": - err = unpopulateTimeRFC3339(val, &a.LastModified) - delete(rawMsg, key) - case "storageAccountName": - err = unpopulate(val, &a.StorageAccountName) - delete(rawMsg, key) - case "storageEncryptionFormat": - err = unpopulate(val, &a.StorageEncryptionFormat) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AssetStreamingLocator - Properties of the Streaming Locator. type AssetStreamingLocator struct { // READ-ONLY; Asset Name. @@ -605,61 +326,6 @@ type AssetStreamingLocator struct { StreamingPolicyName *string `json:"streamingPolicyName,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AssetStreamingLocator. -func (a AssetStreamingLocator) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assetName", a.AssetName) - populateTimeRFC3339(objectMap, "created", a.Created) - populate(objectMap, "defaultContentKeyPolicyName", a.DefaultContentKeyPolicyName) - populateTimeRFC3339(objectMap, "endTime", a.EndTime) - populate(objectMap, "name", a.Name) - populateTimeRFC3339(objectMap, "startTime", a.StartTime) - populate(objectMap, "streamingLocatorId", a.StreamingLocatorID) - populate(objectMap, "streamingPolicyName", a.StreamingPolicyName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssetStreamingLocator. -func (a *AssetStreamingLocator) 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 "assetName": - err = unpopulate(val, &a.AssetName) - delete(rawMsg, key) - case "created": - err = unpopulateTimeRFC3339(val, &a.Created) - delete(rawMsg, key) - case "defaultContentKeyPolicyName": - err = unpopulate(val, &a.DefaultContentKeyPolicyName) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, &a.EndTime) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &a.Name) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &a.StartTime) - delete(rawMsg, key) - case "streamingLocatorId": - err = unpopulate(val, &a.StreamingLocatorID) - delete(rawMsg, key) - case "streamingPolicyName": - err = unpopulate(val, &a.StreamingPolicyName) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AssetTrack - An Asset Track resource. type AssetTrack struct { // The resource properties. @@ -675,29 +341,12 @@ type AssetTrack struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AssetTrack. -func (a AssetTrack) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - // AssetTrackCollection - A collection of AssetTrack items. type AssetTrackCollection struct { // A collection of AssetTrack items. Value []*AssetTrack `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AssetTrackCollection. -func (a AssetTrackCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - // AssetTrackOperationStatus - Status of asset track operation. type AssetTrackOperationStatus struct { // REQUIRED; Operation identifier. @@ -719,53 +368,6 @@ type AssetTrackOperationStatus struct { StartTime *time.Time `json:"startTime,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AssetTrackOperationStatus. -func (a AssetTrackOperationStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "endTime", a.EndTime) - populate(objectMap, "error", a.Error) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populateTimeRFC3339(objectMap, "startTime", a.StartTime) - populate(objectMap, "status", a.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssetTrackOperationStatus. -func (a *AssetTrackOperationStatus) 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 "endTime": - err = unpopulateTimeRFC3339(val, &a.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, &a.Error) - delete(rawMsg, key) - case "id": - err = unpopulate(val, &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &a.Name) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &a.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, &a.Status) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AssetTrackProperties - Properties of a video, audio or text track in the asset. type AssetTrackProperties struct { // Detailed information about a track in the asset. @@ -775,37 +377,6 @@ type AssetTrackProperties struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AssetTrackProperties. -func (a AssetTrackProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "track", a.Track) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssetTrackProperties. -func (a *AssetTrackProperties) 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 "provisioningState": - err = unpopulate(val, &a.ProvisioningState) - delete(rawMsg, key) - case "track": - a.Track, err = unmarshalTrackBaseClassification(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AssetsClientCreateOrUpdateOptions contains the optional parameters for the AssetsClient.CreateOrUpdate method. type AssetsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -880,60 +451,6 @@ type Audio struct { SamplingRate *int32 `json:"samplingRate,omitempty"` } -// GetAudio implements the AudioClassification interface for type Audio. -func (a *Audio) GetAudio() *Audio { return a } - -// GetCodec implements the CodecClassification interface for type Audio. -func (a *Audio) GetCodec() *Codec { - return &Codec{ - ODataType: a.ODataType, - Label: a.Label, - } -} - -// MarshalJSON implements the json.Marshaller interface for type Audio. -func (a Audio) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "bitrate", a.Bitrate) - populate(objectMap, "channels", a.Channels) - populate(objectMap, "label", a.Label) - objectMap["@odata.type"] = "#Microsoft.Media.Audio" - populate(objectMap, "samplingRate", a.SamplingRate) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Audio. -func (a *Audio) 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 "bitrate": - err = unpopulate(val, &a.Bitrate) - delete(rawMsg, key) - case "channels": - err = unpopulate(val, &a.Channels) - delete(rawMsg, key) - case "label": - err = unpopulate(val, &a.Label) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &a.ODataType) - delete(rawMsg, key) - case "samplingRate": - err = unpopulate(val, &a.SamplingRate) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AudioAnalyzerPresetClassification provides polymorphic access to related types. // Call the interface's GetAudioAnalyzerPreset() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -969,55 +486,6 @@ type AudioAnalyzerPreset struct { Mode *AudioAnalysisMode `json:"mode,omitempty"` } -// GetAudioAnalyzerPreset implements the AudioAnalyzerPresetClassification interface for type AudioAnalyzerPreset. -func (a *AudioAnalyzerPreset) GetAudioAnalyzerPreset() *AudioAnalyzerPreset { return a } - -// GetPreset implements the PresetClassification interface for type AudioAnalyzerPreset. -func (a *AudioAnalyzerPreset) GetPreset() *Preset { - return &Preset{ - ODataType: a.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AudioAnalyzerPreset. -func (a AudioAnalyzerPreset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "audioLanguage", a.AudioLanguage) - populate(objectMap, "experimentalOptions", a.ExperimentalOptions) - populate(objectMap, "mode", a.Mode) - objectMap["@odata.type"] = "#Microsoft.Media.AudioAnalyzerPreset" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AudioAnalyzerPreset. -func (a *AudioAnalyzerPreset) 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 "audioLanguage": - err = unpopulate(val, &a.AudioLanguage) - delete(rawMsg, key) - case "experimentalOptions": - err = unpopulate(val, &a.ExperimentalOptions) - delete(rawMsg, key) - case "mode": - err = unpopulate(val, &a.Mode) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &a.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AudioOverlay - Describes the properties of an audio overlay. type AudioOverlay struct { // REQUIRED; The label of the job input which is to be used as an overlay. The Input must specify exactly one file. You can @@ -1053,110 +521,12 @@ type AudioOverlay struct { Start *string `json:"start,omitempty"` } -// GetOverlay implements the OverlayClassification interface for type AudioOverlay. -func (a *AudioOverlay) GetOverlay() *Overlay { - return &Overlay{ - ODataType: a.ODataType, - InputLabel: a.InputLabel, - Start: a.Start, - End: a.End, - FadeInDuration: a.FadeInDuration, - FadeOutDuration: a.FadeOutDuration, - AudioGainLevel: a.AudioGainLevel, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AudioOverlay. -func (a AudioOverlay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "audioGainLevel", a.AudioGainLevel) - populate(objectMap, "end", a.End) - populate(objectMap, "fadeInDuration", a.FadeInDuration) - populate(objectMap, "fadeOutDuration", a.FadeOutDuration) - populate(objectMap, "inputLabel", a.InputLabel) - objectMap["@odata.type"] = "#Microsoft.Media.AudioOverlay" - populate(objectMap, "start", a.Start) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AudioOverlay. -func (a *AudioOverlay) 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 "audioGainLevel": - err = unpopulate(val, &a.AudioGainLevel) - delete(rawMsg, key) - case "end": - err = unpopulate(val, &a.End) - delete(rawMsg, key) - case "fadeInDuration": - err = unpopulate(val, &a.FadeInDuration) - delete(rawMsg, key) - case "fadeOutDuration": - err = unpopulate(val, &a.FadeOutDuration) - delete(rawMsg, key) - case "inputLabel": - err = unpopulate(val, &a.InputLabel) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &a.ODataType) - delete(rawMsg, key) - case "start": - err = unpopulate(val, &a.Start) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AudioTrack - Represents an audio track in the asset. type AudioTrack struct { // REQUIRED; The discriminator for derived types. ODataType *string `json:"@odata.type,omitempty"` } -// GetTrackBase implements the TrackBaseClassification interface for type AudioTrack. -func (a *AudioTrack) GetTrackBase() *TrackBase { - return &TrackBase{ - ODataType: a.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AudioTrack. -func (a AudioTrack) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["@odata.type"] = "#Microsoft.Media.AudioTrack" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AudioTrack. -func (a *AudioTrack) 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 "@odata.type": - err = unpopulate(val, &a.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AudioTrackDescriptorClassification provides polymorphic access to related types. // Call the interface's GetAudioTrackDescriptor() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -1177,47 +547,6 @@ type AudioTrackDescriptor struct { ChannelMapping *ChannelMapping `json:"channelMapping,omitempty"` } -// GetAudioTrackDescriptor implements the AudioTrackDescriptorClassification interface for type AudioTrackDescriptor. -func (a *AudioTrackDescriptor) GetAudioTrackDescriptor() *AudioTrackDescriptor { return a } - -// GetTrackDescriptor implements the TrackDescriptorClassification interface for type AudioTrackDescriptor. -func (a *AudioTrackDescriptor) GetTrackDescriptor() *TrackDescriptor { - return &TrackDescriptor{ - ODataType: a.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AudioTrackDescriptor. -func (a AudioTrackDescriptor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "channelMapping", a.ChannelMapping) - objectMap["@odata.type"] = "#Microsoft.Media.AudioTrackDescriptor" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AudioTrackDescriptor. -func (a *AudioTrackDescriptor) 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 "channelMapping": - err = unpopulate(val, &a.ChannelMapping) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &a.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // BuiltInStandardEncoderPreset - Describes a built-in preset for encoding the input video with the Standard Encoder. type BuiltInStandardEncoderPreset struct { // REQUIRED; The discriminator for derived types. @@ -1231,48 +560,6 @@ type BuiltInStandardEncoderPreset struct { Configurations *PresetConfigurations `json:"configurations,omitempty"` } -// GetPreset implements the PresetClassification interface for type BuiltInStandardEncoderPreset. -func (b *BuiltInStandardEncoderPreset) GetPreset() *Preset { - return &Preset{ - ODataType: b.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type BuiltInStandardEncoderPreset. -func (b BuiltInStandardEncoderPreset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "configurations", b.Configurations) - objectMap["@odata.type"] = "#Microsoft.Media.BuiltInStandardEncoderPreset" - populate(objectMap, "presetName", b.PresetName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BuiltInStandardEncoderPreset. -func (b *BuiltInStandardEncoderPreset) 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 "configurations": - err = unpopulate(val, &b.Configurations) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &b.ODataType) - delete(rawMsg, key) - case "presetName": - err = unpopulate(val, &b.PresetName) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // CbcsDrmConfiguration - Class to specify DRM configurations of CommonEncryptionCbcs scheme in Streaming Policy type CbcsDrmConfiguration struct { // FairPlay configurations @@ -1358,9 +645,6 @@ type ClipTime struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetClipTime implements the ClipTimeClassification interface for type ClipTime. -func (c *ClipTime) GetClipTime() *ClipTime { return c } - // CodecClassification provides polymorphic access to related types. // Call the interface's GetCodec() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -1379,9 +663,6 @@ type Codec struct { Label *string `json:"label,omitempty"` } -// GetCodec implements the CodecClassification interface for type Codec. -func (c *Codec) GetCodec() *Codec { return c } - // CommonEncryptionCbcs - Class for CommonEncryptionCbcs encryption scheme type CommonEncryptionCbcs struct { // Representing which tracks should not be encrypted @@ -1397,16 +678,6 @@ type CommonEncryptionCbcs struct { EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CommonEncryptionCbcs. -func (c CommonEncryptionCbcs) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "clearTracks", c.ClearTracks) - populate(objectMap, "contentKeys", c.ContentKeys) - populate(objectMap, "drm", c.Drm) - populate(objectMap, "enabledProtocols", c.EnabledProtocols) - return json.Marshal(objectMap) -} - // CommonEncryptionCenc - Class for envelope encryption scheme type CommonEncryptionCenc struct { // Representing which tracks should not be encrypted @@ -1422,16 +693,6 @@ type CommonEncryptionCenc struct { EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CommonEncryptionCenc. -func (c CommonEncryptionCenc) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "clearTracks", c.ClearTracks) - populate(objectMap, "contentKeys", c.ContentKeys) - populate(objectMap, "drm", c.Drm) - populate(objectMap, "enabledProtocols", c.EnabledProtocols) - return json.Marshal(objectMap) -} - // ContentKeyPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ContentKeyPoliciesClient.CreateOrUpdate // method. type ContentKeyPoliciesClientCreateOrUpdateOptions struct { @@ -1488,57 +749,12 @@ type ContentKeyPolicy struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicy. -func (c ContentKeyPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - // ContentKeyPolicyClearKeyConfiguration - Represents a configuration for non-DRM keys. type ContentKeyPolicyClearKeyConfiguration struct { // REQUIRED; The discriminator for derived types. ODataType *string `json:"@odata.type,omitempty"` } -// GetContentKeyPolicyConfiguration implements the ContentKeyPolicyConfigurationClassification interface for type ContentKeyPolicyClearKeyConfiguration. -func (c *ContentKeyPolicyClearKeyConfiguration) GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration { - return &ContentKeyPolicyConfiguration{ - ODataType: c.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyClearKeyConfiguration. -func (c ContentKeyPolicyClearKeyConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyClearKeyConfiguration. -func (c *ContentKeyPolicyClearKeyConfiguration) 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 "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicyCollection - A collection of ContentKeyPolicy items. type ContentKeyPolicyCollection struct { // A link to the next page of the collection (when the collection contains too many results to return in one response). @@ -1548,14 +764,6 @@ type ContentKeyPolicyCollection struct { Value []*ContentKeyPolicy `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyCollection. -func (c ContentKeyPolicyCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@odata.nextLink", c.ODataNextLink) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - // ContentKeyPolicyConfigurationClassification provides polymorphic access to related types. // Call the interface's GetContentKeyPolicyConfiguration() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -1573,11 +781,6 @@ type ContentKeyPolicyConfiguration struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetContentKeyPolicyConfiguration implements the ContentKeyPolicyConfigurationClassification interface for type ContentKeyPolicyConfiguration. -func (c *ContentKeyPolicyConfiguration) GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration { - return c -} - // ContentKeyPolicyFairPlayConfiguration - Specifies a configuration for FairPlay licenses. type ContentKeyPolicyFairPlayConfiguration struct { // REQUIRED; The key that must be used as FairPlay Application Secret key. @@ -1602,64 +805,6 @@ type ContentKeyPolicyFairPlayConfiguration struct { OfflineRentalConfiguration *ContentKeyPolicyFairPlayOfflineRentalConfiguration `json:"offlineRentalConfiguration,omitempty"` } -// GetContentKeyPolicyConfiguration implements the ContentKeyPolicyConfigurationClassification interface for type ContentKeyPolicyFairPlayConfiguration. -func (c *ContentKeyPolicyFairPlayConfiguration) GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration { - return &ContentKeyPolicyConfiguration{ - ODataType: c.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyFairPlayConfiguration. -func (c ContentKeyPolicyFairPlayConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateByteArray(objectMap, "ask", c.Ask, runtime.Base64StdFormat) - populate(objectMap, "fairPlayPfx", c.FairPlayPfx) - populate(objectMap, "fairPlayPfxPassword", c.FairPlayPfxPassword) - objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration" - populate(objectMap, "offlineRentalConfiguration", c.OfflineRentalConfiguration) - populate(objectMap, "rentalAndLeaseKeyType", c.RentalAndLeaseKeyType) - populate(objectMap, "rentalDuration", c.RentalDuration) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyFairPlayConfiguration. -func (c *ContentKeyPolicyFairPlayConfiguration) 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 "ask": - err = runtime.DecodeByteArray(string(val), &c.Ask, runtime.Base64StdFormat) - delete(rawMsg, key) - case "fairPlayPfx": - err = unpopulate(val, &c.FairPlayPfx) - delete(rawMsg, key) - case "fairPlayPfxPassword": - err = unpopulate(val, &c.FairPlayPfxPassword) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - case "offlineRentalConfiguration": - err = unpopulate(val, &c.OfflineRentalConfiguration) - delete(rawMsg, key) - case "rentalAndLeaseKeyType": - err = unpopulate(val, &c.RentalAndLeaseKeyType) - delete(rawMsg, key) - case "rentalDuration": - err = unpopulate(val, &c.RentalDuration) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - type ContentKeyPolicyFairPlayOfflineRentalConfiguration struct { // REQUIRED; Playback duration PlaybackDurationSeconds *int64 `json:"playbackDurationSeconds,omitempty"` @@ -1674,40 +819,6 @@ type ContentKeyPolicyOpenRestriction struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetContentKeyPolicyRestriction implements the ContentKeyPolicyRestrictionClassification interface for type ContentKeyPolicyOpenRestriction. -func (c *ContentKeyPolicyOpenRestriction) GetContentKeyPolicyRestriction() *ContentKeyPolicyRestriction { - return &ContentKeyPolicyRestriction{ - ODataType: c.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyOpenRestriction. -func (c ContentKeyPolicyOpenRestriction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyOpenRestriction" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyOpenRestriction. -func (c *ContentKeyPolicyOpenRestriction) 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 "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicyOption - Represents a policy option. type ContentKeyPolicyOption struct { // REQUIRED; The key delivery configuration. @@ -1723,45 +834,6 @@ type ContentKeyPolicyOption struct { PolicyOptionID *string `json:"policyOptionId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyOption. -func (c ContentKeyPolicyOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "configuration", c.Configuration) - populate(objectMap, "name", c.Name) - populate(objectMap, "policyOptionId", c.PolicyOptionID) - populate(objectMap, "restriction", c.Restriction) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyOption. -func (c *ContentKeyPolicyOption) 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 "configuration": - c.Configuration, err = unmarshalContentKeyPolicyConfigurationClassification(val) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &c.Name) - delete(rawMsg, key) - case "policyOptionId": - err = unpopulate(val, &c.PolicyOptionID) - delete(rawMsg, key) - case "restriction": - c.Restriction, err = unmarshalContentKeyPolicyRestrictionClassification(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicyPlayReadyConfiguration - Specifies a configuration for PlayReady licenses. type ContentKeyPolicyPlayReadyConfiguration struct { // REQUIRED; The PlayReady licenses. @@ -1774,89 +846,12 @@ type ContentKeyPolicyPlayReadyConfiguration struct { ResponseCustomData *string `json:"responseCustomData,omitempty"` } -// GetContentKeyPolicyConfiguration implements the ContentKeyPolicyConfigurationClassification interface for type ContentKeyPolicyPlayReadyConfiguration. -func (c *ContentKeyPolicyPlayReadyConfiguration) GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration { - return &ContentKeyPolicyConfiguration{ - ODataType: c.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyPlayReadyConfiguration. -func (c ContentKeyPolicyPlayReadyConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "licenses", c.Licenses) - objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration" - populate(objectMap, "responseCustomData", c.ResponseCustomData) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyPlayReadyConfiguration. -func (c *ContentKeyPolicyPlayReadyConfiguration) 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 "licenses": - err = unpopulate(val, &c.Licenses) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - case "responseCustomData": - err = unpopulate(val, &c.ResponseCustomData) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader - Specifies that the content key ID is in the PlayReady header. type ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader struct { // REQUIRED; The discriminator for derived types. ODataType *string `json:"@odata.type,omitempty"` } -// GetContentKeyPolicyPlayReadyContentKeyLocation implements the ContentKeyPolicyPlayReadyContentKeyLocationClassification -// interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader. -func (c *ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) GetContentKeyPolicyPlayReadyContentKeyLocation() *ContentKeyPolicyPlayReadyContentKeyLocation { - return &ContentKeyPolicyPlayReadyContentKeyLocation{ - ODataType: c.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader. -func (c ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader. -func (c *ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) 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 "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier - Specifies that the content key ID is specified in the // PlayReady configuration. type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier struct { @@ -1867,45 +862,6 @@ type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetContentKeyPolicyPlayReadyContentKeyLocation implements the ContentKeyPolicyPlayReadyContentKeyLocationClassification -// interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. -func (c *ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) GetContentKeyPolicyPlayReadyContentKeyLocation() *ContentKeyPolicyPlayReadyContentKeyLocation { - return &ContentKeyPolicyPlayReadyContentKeyLocation{ - ODataType: c.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. -func (c ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "keyId", c.KeyID) - objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. -func (c *ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) 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 "keyId": - err = unpopulate(val, &c.KeyID) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicyPlayReadyContentKeyLocationClassification provides polymorphic access to related types. // Call the interface's GetContentKeyPolicyPlayReadyContentKeyLocation() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -1923,12 +879,6 @@ type ContentKeyPolicyPlayReadyContentKeyLocation struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetContentKeyPolicyPlayReadyContentKeyLocation implements the ContentKeyPolicyPlayReadyContentKeyLocationClassification -// interface for type ContentKeyPolicyPlayReadyContentKeyLocation. -func (c *ContentKeyPolicyPlayReadyContentKeyLocation) GetContentKeyPolicyPlayReadyContentKeyLocation() *ContentKeyPolicyPlayReadyContentKeyLocation { - return c -} - // ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction - Configures the Explicit Analog Television Output Restriction // control bits. For further details see the PlayReady Compliance Rules. type ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction struct { @@ -1972,69 +922,6 @@ type ContentKeyPolicyPlayReadyLicense struct { RelativeExpirationDate *string `json:"relativeExpirationDate,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyPlayReadyLicense. -func (c ContentKeyPolicyPlayReadyLicense) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowTestDevices", c.AllowTestDevices) - populateTimeRFC3339(objectMap, "beginDate", c.BeginDate) - populate(objectMap, "contentKeyLocation", c.ContentKeyLocation) - populate(objectMap, "contentType", c.ContentType) - populateTimeRFC3339(objectMap, "expirationDate", c.ExpirationDate) - populate(objectMap, "gracePeriod", c.GracePeriod) - populate(objectMap, "licenseType", c.LicenseType) - populate(objectMap, "playRight", c.PlayRight) - populate(objectMap, "relativeBeginDate", c.RelativeBeginDate) - populate(objectMap, "relativeExpirationDate", c.RelativeExpirationDate) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyPlayReadyLicense. -func (c *ContentKeyPolicyPlayReadyLicense) 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 "allowTestDevices": - err = unpopulate(val, &c.AllowTestDevices) - delete(rawMsg, key) - case "beginDate": - err = unpopulateTimeRFC3339(val, &c.BeginDate) - delete(rawMsg, key) - case "contentKeyLocation": - c.ContentKeyLocation, err = unmarshalContentKeyPolicyPlayReadyContentKeyLocationClassification(val) - delete(rawMsg, key) - case "contentType": - err = unpopulate(val, &c.ContentType) - delete(rawMsg, key) - case "expirationDate": - err = unpopulateTimeRFC3339(val, &c.ExpirationDate) - delete(rawMsg, key) - case "gracePeriod": - err = unpopulate(val, &c.GracePeriod) - delete(rawMsg, key) - case "licenseType": - err = unpopulate(val, &c.LicenseType) - delete(rawMsg, key) - case "playRight": - err = unpopulate(val, &c.PlayRight) - delete(rawMsg, key) - case "relativeBeginDate": - err = unpopulate(val, &c.RelativeBeginDate) - delete(rawMsg, key) - case "relativeExpirationDate": - err = unpopulate(val, &c.RelativeExpirationDate) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicyPlayReadyPlayRight - Configures the Play Right in the PlayReady license. type ContentKeyPolicyPlayReadyPlayRight struct { // REQUIRED; Configures Unknown output handling settings of the license. @@ -2096,49 +983,6 @@ type ContentKeyPolicyProperties struct { PolicyID *string `json:"policyId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyProperties. -func (c ContentKeyPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "created", c.Created) - populate(objectMap, "description", c.Description) - populateTimeRFC3339(objectMap, "lastModified", c.LastModified) - populate(objectMap, "options", c.Options) - populate(objectMap, "policyId", c.PolicyID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyProperties. -func (c *ContentKeyPolicyProperties) 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 "created": - err = unpopulateTimeRFC3339(val, &c.Created) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &c.Description) - delete(rawMsg, key) - case "lastModified": - err = unpopulateTimeRFC3339(val, &c.LastModified) - delete(rawMsg, key) - case "options": - err = unpopulate(val, &c.Options) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, &c.PolicyID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicyRestrictionClassification provides polymorphic access to related types. // Call the interface's GetContentKeyPolicyRestriction() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -2155,11 +999,6 @@ type ContentKeyPolicyRestriction struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetContentKeyPolicyRestriction implements the ContentKeyPolicyRestrictionClassification interface for type ContentKeyPolicyRestriction. -func (c *ContentKeyPolicyRestriction) GetContentKeyPolicyRestriction() *ContentKeyPolicyRestriction { - return c -} - // ContentKeyPolicyRestrictionTokenKeyClassification provides polymorphic access to related types. // Call the interface's GetContentKeyPolicyRestrictionTokenKey() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -2176,12 +1015,6 @@ type ContentKeyPolicyRestrictionTokenKey struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetContentKeyPolicyRestrictionTokenKey implements the ContentKeyPolicyRestrictionTokenKeyClassification interface for type -// ContentKeyPolicyRestrictionTokenKey. -func (c *ContentKeyPolicyRestrictionTokenKey) GetContentKeyPolicyRestrictionTokenKey() *ContentKeyPolicyRestrictionTokenKey { - return c -} - // ContentKeyPolicyRsaTokenKey - Specifies a RSA key for token validation type ContentKeyPolicyRsaTokenKey struct { // REQUIRED; The RSA Parameter exponent @@ -2194,49 +1027,6 @@ type ContentKeyPolicyRsaTokenKey struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetContentKeyPolicyRestrictionTokenKey implements the ContentKeyPolicyRestrictionTokenKeyClassification interface for type -// ContentKeyPolicyRsaTokenKey. -func (c *ContentKeyPolicyRsaTokenKey) GetContentKeyPolicyRestrictionTokenKey() *ContentKeyPolicyRestrictionTokenKey { - return &ContentKeyPolicyRestrictionTokenKey{ - ODataType: c.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyRsaTokenKey. -func (c ContentKeyPolicyRsaTokenKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateByteArray(objectMap, "exponent", c.Exponent, runtime.Base64StdFormat) - populateByteArray(objectMap, "modulus", c.Modulus, runtime.Base64StdFormat) - objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyRsaTokenKey" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyRsaTokenKey. -func (c *ContentKeyPolicyRsaTokenKey) 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 "exponent": - err = runtime.DecodeByteArray(string(val), &c.Exponent, runtime.Base64StdFormat) - delete(rawMsg, key) - case "modulus": - err = runtime.DecodeByteArray(string(val), &c.Modulus, runtime.Base64StdFormat) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicySymmetricTokenKey - Specifies a symmetric key for token validation. type ContentKeyPolicySymmetricTokenKey struct { // REQUIRED; The key value of the key @@ -2246,45 +1036,6 @@ type ContentKeyPolicySymmetricTokenKey struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetContentKeyPolicyRestrictionTokenKey implements the ContentKeyPolicyRestrictionTokenKeyClassification interface for type -// ContentKeyPolicySymmetricTokenKey. -func (c *ContentKeyPolicySymmetricTokenKey) GetContentKeyPolicyRestrictionTokenKey() *ContentKeyPolicyRestrictionTokenKey { - return &ContentKeyPolicyRestrictionTokenKey{ - ODataType: c.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicySymmetricTokenKey. -func (c ContentKeyPolicySymmetricTokenKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateByteArray(objectMap, "keyValue", c.KeyValue, runtime.Base64StdFormat) - objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicySymmetricTokenKey. -func (c *ContentKeyPolicySymmetricTokenKey) 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 "keyValue": - err = runtime.DecodeByteArray(string(val), &c.KeyValue, runtime.Base64StdFormat) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicyTokenClaim - Represents a token claim. type ContentKeyPolicyTokenClaim struct { // Token claim type. @@ -2322,68 +1073,6 @@ type ContentKeyPolicyTokenRestriction struct { RequiredClaims []*ContentKeyPolicyTokenClaim `json:"requiredClaims,omitempty"` } -// GetContentKeyPolicyRestriction implements the ContentKeyPolicyRestrictionClassification interface for type ContentKeyPolicyTokenRestriction. -func (c *ContentKeyPolicyTokenRestriction) GetContentKeyPolicyRestriction() *ContentKeyPolicyRestriction { - return &ContentKeyPolicyRestriction{ - ODataType: c.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyTokenRestriction. -func (c ContentKeyPolicyTokenRestriction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alternateVerificationKeys", c.AlternateVerificationKeys) - populate(objectMap, "audience", c.Audience) - populate(objectMap, "issuer", c.Issuer) - objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyTokenRestriction" - populate(objectMap, "openIdConnectDiscoveryDocument", c.OpenIDConnectDiscoveryDocument) - populate(objectMap, "primaryVerificationKey", c.PrimaryVerificationKey) - populate(objectMap, "requiredClaims", c.RequiredClaims) - populate(objectMap, "restrictionTokenType", c.RestrictionTokenType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyTokenRestriction. -func (c *ContentKeyPolicyTokenRestriction) 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 "alternateVerificationKeys": - c.AlternateVerificationKeys, err = unmarshalContentKeyPolicyRestrictionTokenKeyClassificationArray(val) - delete(rawMsg, key) - case "audience": - err = unpopulate(val, &c.Audience) - delete(rawMsg, key) - case "issuer": - err = unpopulate(val, &c.Issuer) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - case "openIdConnectDiscoveryDocument": - err = unpopulate(val, &c.OpenIDConnectDiscoveryDocument) - delete(rawMsg, key) - case "primaryVerificationKey": - c.PrimaryVerificationKey, err = unmarshalContentKeyPolicyRestrictionTokenKeyClassification(val) - delete(rawMsg, key) - case "requiredClaims": - err = unpopulate(val, &c.RequiredClaims) - delete(rawMsg, key) - case "restrictionTokenType": - err = unpopulate(val, &c.RestrictionTokenType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicyUnknownConfiguration - Represents a ContentKeyPolicyConfiguration that is unavailable in the current API // version. type ContentKeyPolicyUnknownConfiguration struct { @@ -2391,80 +1080,12 @@ type ContentKeyPolicyUnknownConfiguration struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetContentKeyPolicyConfiguration implements the ContentKeyPolicyConfigurationClassification interface for type ContentKeyPolicyUnknownConfiguration. -func (c *ContentKeyPolicyUnknownConfiguration) GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration { - return &ContentKeyPolicyConfiguration{ - ODataType: c.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyUnknownConfiguration. -func (c ContentKeyPolicyUnknownConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyUnknownConfiguration" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyUnknownConfiguration. -func (c *ContentKeyPolicyUnknownConfiguration) 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 "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicyUnknownRestriction - Represents a ContentKeyPolicyRestriction that is unavailable in the current API version. type ContentKeyPolicyUnknownRestriction struct { // REQUIRED; The discriminator for derived types. ODataType *string `json:"@odata.type,omitempty"` } -// GetContentKeyPolicyRestriction implements the ContentKeyPolicyRestrictionClassification interface for type ContentKeyPolicyUnknownRestriction. -func (c *ContentKeyPolicyUnknownRestriction) GetContentKeyPolicyRestriction() *ContentKeyPolicyRestriction { - return &ContentKeyPolicyRestriction{ - ODataType: c.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyUnknownRestriction. -func (c ContentKeyPolicyUnknownRestriction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyUnknownRestriction" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyUnknownRestriction. -func (c *ContentKeyPolicyUnknownRestriction) 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 "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicyWidevineConfiguration - Specifies a configuration for Widevine licenses. type ContentKeyPolicyWidevineConfiguration struct { // REQUIRED; The discriminator for derived types. @@ -2474,44 +1095,6 @@ type ContentKeyPolicyWidevineConfiguration struct { WidevineTemplate *string `json:"widevineTemplate,omitempty"` } -// GetContentKeyPolicyConfiguration implements the ContentKeyPolicyConfigurationClassification interface for type ContentKeyPolicyWidevineConfiguration. -func (c *ContentKeyPolicyWidevineConfiguration) GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration { - return &ContentKeyPolicyConfiguration{ - ODataType: c.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyWidevineConfiguration. -func (c ContentKeyPolicyWidevineConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration" - populate(objectMap, "widevineTemplate", c.WidevineTemplate) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyWidevineConfiguration. -func (c *ContentKeyPolicyWidevineConfiguration) 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 "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - case "widevineTemplate": - err = unpopulate(val, &c.WidevineTemplate) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ContentKeyPolicyX509CertificateTokenKey - Specifies a certificate for token validation. type ContentKeyPolicyX509CertificateTokenKey struct { // REQUIRED; The discriminator for derived types. @@ -2521,45 +1104,6 @@ type ContentKeyPolicyX509CertificateTokenKey struct { RawBody []byte `json:"rawBody,omitempty"` } -// GetContentKeyPolicyRestrictionTokenKey implements the ContentKeyPolicyRestrictionTokenKeyClassification interface for type -// ContentKeyPolicyX509CertificateTokenKey. -func (c *ContentKeyPolicyX509CertificateTokenKey) GetContentKeyPolicyRestrictionTokenKey() *ContentKeyPolicyRestrictionTokenKey { - return &ContentKeyPolicyRestrictionTokenKey{ - ODataType: c.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyX509CertificateTokenKey. -func (c ContentKeyPolicyX509CertificateTokenKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey" - populateByteArray(objectMap, "rawBody", c.RawBody, runtime.Base64StdFormat) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyX509CertificateTokenKey. -func (c *ContentKeyPolicyX509CertificateTokenKey) 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 "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - case "rawBody": - err = runtime.DecodeByteArray(string(val), &c.RawBody, runtime.Base64StdFormat) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // CopyAudio - A codec flag, which tells the encoder to copy the input audio bitstream. type CopyAudio struct { // REQUIRED; The discriminator for derived types. @@ -2569,45 +1113,6 @@ type CopyAudio struct { Label *string `json:"label,omitempty"` } -// GetCodec implements the CodecClassification interface for type CopyAudio. -func (c *CopyAudio) GetCodec() *Codec { - return &Codec{ - ODataType: c.ODataType, - Label: c.Label, - } -} - -// MarshalJSON implements the json.Marshaller interface for type CopyAudio. -func (c CopyAudio) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "label", c.Label) - objectMap["@odata.type"] = "#Microsoft.Media.CopyAudio" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CopyAudio. -func (c *CopyAudio) 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 "label": - err = unpopulate(val, &c.Label) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // CopyVideo - A codec flag, which tells the encoder to copy the input video bitstream without re-encoding. type CopyVideo struct { // REQUIRED; The discriminator for derived types. @@ -2617,45 +1122,6 @@ type CopyVideo struct { Label *string `json:"label,omitempty"` } -// GetCodec implements the CodecClassification interface for type CopyVideo. -func (c *CopyVideo) GetCodec() *Codec { - return &Codec{ - ODataType: c.ODataType, - Label: c.Label, - } -} - -// MarshalJSON implements the json.Marshaller interface for type CopyVideo. -func (c CopyVideo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "label", c.Label) - objectMap["@odata.type"] = "#Microsoft.Media.CopyVideo" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CopyVideo. -func (c *CopyVideo) 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 "label": - err = unpopulate(val, &c.Label) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &c.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // CrossSiteAccessPolicies - The client access policy. type CrossSiteAccessPolicies struct { // The content of clientaccesspolicy.xml used by Silverlight. @@ -2758,16 +1224,6 @@ type EnvelopeEncryption struct { EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type EnvelopeEncryption. -func (e EnvelopeEncryption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "clearTracks", e.ClearTracks) - populate(objectMap, "contentKeys", e.ContentKeys) - populate(objectMap, "customKeyAcquisitionUrlTemplate", e.CustomKeyAcquisitionURLTemplate) - populate(objectMap, "enabledProtocols", e.EnabledProtocols) - return json.Marshal(objectMap) -} - // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -2795,15 +1251,11 @@ type ErrorDetail struct { 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 - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail `json:"error,omitempty"` } // FaceDetectorPreset - Describes all the settings to be used when analyzing a video in order to detect (and optionally redact) @@ -2837,56 +1289,6 @@ type FaceDetectorPreset struct { Resolution *AnalysisResolution `json:"resolution,omitempty"` } -// GetPreset implements the PresetClassification interface for type FaceDetectorPreset. -func (f *FaceDetectorPreset) GetPreset() *Preset { - return &Preset{ - ODataType: f.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type FaceDetectorPreset. -func (f FaceDetectorPreset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "blurType", f.BlurType) - populate(objectMap, "experimentalOptions", f.ExperimentalOptions) - populate(objectMap, "mode", f.Mode) - objectMap["@odata.type"] = "#Microsoft.Media.FaceDetectorPreset" - populate(objectMap, "resolution", f.Resolution) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FaceDetectorPreset. -func (f *FaceDetectorPreset) 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 "blurType": - err = unpopulate(val, &f.BlurType) - delete(rawMsg, key) - case "experimentalOptions": - err = unpopulate(val, &f.ExperimentalOptions) - delete(rawMsg, key) - case "mode": - err = unpopulate(val, &f.Mode) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &f.ODataType) - delete(rawMsg, key) - case "resolution": - err = unpopulate(val, &f.Resolution) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // FilterTrackPropertyCondition - The class to specify one track property condition. type FilterTrackPropertyCondition struct { // REQUIRED; The track property condition operation. @@ -2906,13 +1308,6 @@ type FilterTrackSelection struct { TrackSelections []*FilterTrackPropertyCondition `json:"trackSelections,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type FilterTrackSelection. -func (f FilterTrackSelection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "trackSelections", f.TrackSelections) - return json.Marshal(objectMap) -} - // Filters - Describes all the filtering operations, such as de-interlacing, rotation etc. that are to be applied to the input // media before encoding. type Filters struct { @@ -2929,45 +1324,6 @@ type Filters struct { Rotation *Rotation `json:"rotation,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type Filters. -func (f Filters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "crop", f.Crop) - populate(objectMap, "deinterlace", f.Deinterlace) - populate(objectMap, "overlays", f.Overlays) - populate(objectMap, "rotation", f.Rotation) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Filters. -func (f *Filters) 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 "crop": - err = unpopulate(val, &f.Crop) - delete(rawMsg, key) - case "deinterlace": - err = unpopulate(val, &f.Deinterlace) - delete(rawMsg, key) - case "overlays": - f.Overlays, err = unmarshalOverlayClassificationArray(val) - delete(rawMsg, key) - case "rotation": - err = unpopulate(val, &f.Rotation) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // FirstQuality - Filter First Quality type FirstQuality struct { // REQUIRED; The first quality bitrate. @@ -3000,9 +1356,6 @@ type Format struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetFormat implements the FormatClassification interface for type Format. -func (f *Format) GetFormat() *Format { return f } - // FromAllInputFile - An InputDefinition that looks across all of the files provided to select tracks specified by the IncludedTracks // property. Generally used with the AudioTrackByAttribute and VideoTrackByAttribute to // allow selection of a single track across a set of input files. @@ -3014,45 +1367,6 @@ type FromAllInputFile struct { IncludedTracks []TrackDescriptorClassification `json:"includedTracks,omitempty"` } -// GetInputDefinition implements the InputDefinitionClassification interface for type FromAllInputFile. -func (f *FromAllInputFile) GetInputDefinition() *InputDefinition { - return &InputDefinition{ - ODataType: f.ODataType, - IncludedTracks: f.IncludedTracks, - } -} - -// MarshalJSON implements the json.Marshaller interface for type FromAllInputFile. -func (f FromAllInputFile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "includedTracks", f.IncludedTracks) - objectMap["@odata.type"] = "#Microsoft.Media.FromAllInputFile" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FromAllInputFile. -func (f *FromAllInputFile) 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 "includedTracks": - f.IncludedTracks, err = unmarshalTrackDescriptorClassificationArray(val) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &f.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // FromEachInputFile - An InputDefinition that looks at each input file provided to select tracks specified by the IncludedTracks // property. Generally used with the AudioTrackByAttribute and VideoTrackByAttribute to select // tracks from each file given. @@ -3064,45 +1378,6 @@ type FromEachInputFile struct { IncludedTracks []TrackDescriptorClassification `json:"includedTracks,omitempty"` } -// GetInputDefinition implements the InputDefinitionClassification interface for type FromEachInputFile. -func (f *FromEachInputFile) GetInputDefinition() *InputDefinition { - return &InputDefinition{ - ODataType: f.ODataType, - IncludedTracks: f.IncludedTracks, - } -} - -// MarshalJSON implements the json.Marshaller interface for type FromEachInputFile. -func (f FromEachInputFile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "includedTracks", f.IncludedTracks) - objectMap["@odata.type"] = "#Microsoft.Media.FromEachInputFile" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FromEachInputFile. -func (f *FromEachInputFile) 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 "includedTracks": - f.IncludedTracks, err = unmarshalTrackDescriptorClassificationArray(val) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &f.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // H264Layer - Describes the settings to be used when encoding the input video into a desired output bitrate layer with the // H.264 video codec. type H264Layer struct { @@ -3205,84 +1480,6 @@ type H264Video struct { SyncMode *VideoSyncMode `json:"syncMode,omitempty"` } -// GetCodec implements the CodecClassification interface for type H264Video. -func (h *H264Video) GetCodec() *Codec { - return &Codec{ - ODataType: h.ODataType, - Label: h.Label, - } -} - -// GetVideo implements the VideoClassification interface for type H264Video. -func (h *H264Video) GetVideo() *Video { - return &Video{ - KeyFrameInterval: h.KeyFrameInterval, - StretchMode: h.StretchMode, - SyncMode: h.SyncMode, - ODataType: h.ODataType, - Label: h.Label, - } -} - -// MarshalJSON implements the json.Marshaller interface for type H264Video. -func (h H264Video) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "complexity", h.Complexity) - populate(objectMap, "keyFrameInterval", h.KeyFrameInterval) - populate(objectMap, "label", h.Label) - populate(objectMap, "layers", h.Layers) - objectMap["@odata.type"] = "#Microsoft.Media.H264Video" - populate(objectMap, "rateControlMode", h.RateControlMode) - populate(objectMap, "sceneChangeDetection", h.SceneChangeDetection) - populate(objectMap, "stretchMode", h.StretchMode) - populate(objectMap, "syncMode", h.SyncMode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type H264Video. -func (h *H264Video) 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 "complexity": - err = unpopulate(val, &h.Complexity) - delete(rawMsg, key) - case "keyFrameInterval": - err = unpopulate(val, &h.KeyFrameInterval) - delete(rawMsg, key) - case "label": - err = unpopulate(val, &h.Label) - delete(rawMsg, key) - case "layers": - err = unpopulate(val, &h.Layers) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &h.ODataType) - delete(rawMsg, key) - case "rateControlMode": - err = unpopulate(val, &h.RateControlMode) - delete(rawMsg, key) - case "sceneChangeDetection": - err = unpopulate(val, &h.SceneChangeDetection) - delete(rawMsg, key) - case "stretchMode": - err = unpopulate(val, &h.StretchMode) - delete(rawMsg, key) - case "syncMode": - err = unpopulate(val, &h.SyncMode) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // H265Layer - Describes the settings to be used when encoding the input video into a desired output bitrate layer with the // H.265 video codec. type H265Layer struct { @@ -3381,80 +1578,6 @@ type H265Video struct { SyncMode *VideoSyncMode `json:"syncMode,omitempty"` } -// GetCodec implements the CodecClassification interface for type H265Video. -func (h *H265Video) GetCodec() *Codec { - return &Codec{ - ODataType: h.ODataType, - Label: h.Label, - } -} - -// GetVideo implements the VideoClassification interface for type H265Video. -func (h *H265Video) GetVideo() *Video { - return &Video{ - KeyFrameInterval: h.KeyFrameInterval, - StretchMode: h.StretchMode, - SyncMode: h.SyncMode, - ODataType: h.ODataType, - Label: h.Label, - } -} - -// MarshalJSON implements the json.Marshaller interface for type H265Video. -func (h H265Video) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "complexity", h.Complexity) - populate(objectMap, "keyFrameInterval", h.KeyFrameInterval) - populate(objectMap, "label", h.Label) - populate(objectMap, "layers", h.Layers) - objectMap["@odata.type"] = "#Microsoft.Media.H265Video" - populate(objectMap, "sceneChangeDetection", h.SceneChangeDetection) - populate(objectMap, "stretchMode", h.StretchMode) - populate(objectMap, "syncMode", h.SyncMode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type H265Video. -func (h *H265Video) 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 "complexity": - err = unpopulate(val, &h.Complexity) - delete(rawMsg, key) - case "keyFrameInterval": - err = unpopulate(val, &h.KeyFrameInterval) - delete(rawMsg, key) - case "label": - err = unpopulate(val, &h.Label) - delete(rawMsg, key) - case "layers": - err = unpopulate(val, &h.Layers) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &h.ODataType) - delete(rawMsg, key) - case "sceneChangeDetection": - err = unpopulate(val, &h.SceneChangeDetection) - delete(rawMsg, key) - case "stretchMode": - err = unpopulate(val, &h.StretchMode) - delete(rawMsg, key) - case "syncMode": - err = unpopulate(val, &h.SyncMode) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // H265VideoLayer - Describes the settings to be used when encoding the input video into a desired output bitrate layer. type H265VideoLayer struct { // REQUIRED; The average bitrate in bits per second at which to encode the input video when generating this layer. For example: @@ -3522,13 +1645,6 @@ type IPAccessControl struct { Allow []*IPRange `json:"allow,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type IPAccessControl. -func (i IPAccessControl) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allow", i.Allow) - return json.Marshal(objectMap) -} - // IPRange - The IP address range in the CIDR scheme. type IPRange struct { // The IP address. @@ -3598,83 +1714,6 @@ type Image struct { SyncMode *VideoSyncMode `json:"syncMode,omitempty"` } -// GetCodec implements the CodecClassification interface for type Image. -func (i *Image) GetCodec() *Codec { - return &Codec{ - ODataType: i.ODataType, - Label: i.Label, - } -} - -// GetImage implements the ImageClassification interface for type Image. -func (i *Image) GetImage() *Image { return i } - -// GetVideo implements the VideoClassification interface for type Image. -func (i *Image) GetVideo() *Video { - return &Video{ - KeyFrameInterval: i.KeyFrameInterval, - StretchMode: i.StretchMode, - SyncMode: i.SyncMode, - ODataType: i.ODataType, - Label: i.Label, - } -} - -// MarshalJSON implements the json.Marshaller interface for type Image. -func (i Image) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "keyFrameInterval", i.KeyFrameInterval) - populate(objectMap, "label", i.Label) - objectMap["@odata.type"] = "#Microsoft.Media.Image" - populate(objectMap, "range", i.Range) - populate(objectMap, "start", i.Start) - populate(objectMap, "step", i.Step) - populate(objectMap, "stretchMode", i.StretchMode) - populate(objectMap, "syncMode", i.SyncMode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Image. -func (i *Image) 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 "keyFrameInterval": - err = unpopulate(val, &i.KeyFrameInterval) - delete(rawMsg, key) - case "label": - err = unpopulate(val, &i.Label) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &i.ODataType) - delete(rawMsg, key) - case "range": - err = unpopulate(val, &i.Range) - delete(rawMsg, key) - case "start": - err = unpopulate(val, &i.Start) - delete(rawMsg, key) - case "step": - err = unpopulate(val, &i.Step) - delete(rawMsg, key) - case "stretchMode": - err = unpopulate(val, &i.StretchMode) - delete(rawMsg, key) - case "syncMode": - err = unpopulate(val, &i.SyncMode) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ImageFormatClassification provides polymorphic access to related types. // Call the interface's GetImageFormat() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -3702,48 +1741,6 @@ type ImageFormat struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetFormat implements the FormatClassification interface for type ImageFormat. -func (i *ImageFormat) GetFormat() *Format { - return &Format{ - ODataType: i.ODataType, - FilenamePattern: i.FilenamePattern, - } -} - -// GetImageFormat implements the ImageFormatClassification interface for type ImageFormat. -func (i *ImageFormat) GetImageFormat() *ImageFormat { return i } - -// MarshalJSON implements the json.Marshaller interface for type ImageFormat. -func (i ImageFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filenamePattern", i.FilenamePattern) - objectMap["@odata.type"] = "#Microsoft.Media.ImageFormat" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageFormat. -func (i *ImageFormat) 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 "filenamePattern": - err = unpopulate(val, &i.FilenamePattern) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &i.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // InputDefinitionClassification provides polymorphic access to related types. // Call the interface's GetInputDefinition() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -3763,40 +1760,6 @@ type InputDefinition struct { IncludedTracks []TrackDescriptorClassification `json:"includedTracks,omitempty"` } -// GetInputDefinition implements the InputDefinitionClassification interface for type InputDefinition. -func (i *InputDefinition) GetInputDefinition() *InputDefinition { return i } - -// MarshalJSON implements the json.Marshaller interface for type InputDefinition. -func (i InputDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "includedTracks", i.IncludedTracks) - objectMap["@odata.type"] = i.ODataType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InputDefinition. -func (i *InputDefinition) 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 "includedTracks": - i.IncludedTracks, err = unmarshalTrackDescriptorClassificationArray(val) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &i.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // InputFile - An InputDefinition for a single file. TrackSelections are scoped to the file specified. type InputFile struct { // REQUIRED; The discriminator for derived types. @@ -3809,49 +1772,6 @@ type InputFile struct { IncludedTracks []TrackDescriptorClassification `json:"includedTracks,omitempty"` } -// GetInputDefinition implements the InputDefinitionClassification interface for type InputFile. -func (i *InputFile) GetInputDefinition() *InputDefinition { - return &InputDefinition{ - ODataType: i.ODataType, - IncludedTracks: i.IncludedTracks, - } -} - -// MarshalJSON implements the json.Marshaller interface for type InputFile. -func (i InputFile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filename", i.Filename) - populate(objectMap, "includedTracks", i.IncludedTracks) - objectMap["@odata.type"] = "#Microsoft.Media.InputFile" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InputFile. -func (i *InputFile) 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 "filename": - err = unpopulate(val, &i.Filename) - delete(rawMsg, key) - case "includedTracks": - i.IncludedTracks, err = unmarshalTrackDescriptorClassificationArray(val) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &i.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // Job - A Job resource type. The progress and state can be obtained by polling a Job or subscribing to events using EventGrid. type Job struct { // The resource properties. @@ -3870,17 +1790,6 @@ type Job struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Job. -func (j Job) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", j.ID) - populate(objectMap, "name", j.Name) - populate(objectMap, "properties", j.Properties) - populate(objectMap, "systemData", j.SystemData) - populate(objectMap, "type", j.Type) - return json.Marshal(objectMap) -} - // JobCollection - A collection of Job items. type JobCollection struct { // A link to the next page of the collection (when the collection contains too many results to return in one response). @@ -3890,14 +1799,6 @@ type JobCollection struct { Value []*Job `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type JobCollection. -func (j JobCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@odata.nextLink", j.ODataNextLink) - populate(objectMap, "value", j.Value) - return json.Marshal(objectMap) -} - // JobError - Details of JobOutput errors. type JobError struct { // READ-ONLY; Helps with categorization of errors. @@ -3917,17 +1818,6 @@ type JobError struct { Retry *JobRetry `json:"retry,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type JobError. -func (j JobError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "category", j.Category) - populate(objectMap, "code", j.Code) - populate(objectMap, "details", j.Details) - populate(objectMap, "message", j.Message) - populate(objectMap, "retry", j.Retry) - return json.Marshal(objectMap) -} - // JobErrorDetail - Details of JobOutput errors. type JobErrorDetail struct { // READ-ONLY; Code describing the error detail. @@ -3952,9 +1842,6 @@ type JobInput struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetJobInput implements the JobInputClassification interface for type JobInput. -func (j *JobInput) GetJobInput() *JobInput { return j } - // JobInputAsset - Represents an Asset for input into a Job. type JobInputAsset struct { // REQUIRED; The name of the input Asset. @@ -3984,76 +1871,6 @@ type JobInputAsset struct { Start ClipTimeClassification `json:"start,omitempty"` } -// GetJobInput implements the JobInputClassification interface for type JobInputAsset. -func (j *JobInputAsset) GetJobInput() *JobInput { - return &JobInput{ - ODataType: j.ODataType, - } -} - -// GetJobInputClip implements the JobInputClipClassification interface for type JobInputAsset. -func (j *JobInputAsset) GetJobInputClip() *JobInputClip { - return &JobInputClip{ - Files: j.Files, - Start: j.Start, - End: j.End, - Label: j.Label, - InputDefinitions: j.InputDefinitions, - ODataType: j.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type JobInputAsset. -func (j JobInputAsset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assetName", j.AssetName) - populate(objectMap, "end", j.End) - populate(objectMap, "files", j.Files) - populate(objectMap, "inputDefinitions", j.InputDefinitions) - populate(objectMap, "label", j.Label) - objectMap["@odata.type"] = "#Microsoft.Media.JobInputAsset" - populate(objectMap, "start", j.Start) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputAsset. -func (j *JobInputAsset) 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 "assetName": - err = unpopulate(val, &j.AssetName) - delete(rawMsg, key) - case "end": - j.End, err = unmarshalClipTimeClassification(val) - delete(rawMsg, key) - case "files": - err = unpopulate(val, &j.Files) - delete(rawMsg, key) - case "inputDefinitions": - j.InputDefinitions, err = unmarshalInputDefinitionClassificationArray(val) - delete(rawMsg, key) - case "label": - err = unpopulate(val, &j.Label) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &j.ODataType) - delete(rawMsg, key) - case "start": - j.Start, err = unmarshalClipTimeClassification(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // JobInputClipClassification provides polymorphic access to related types. // Call the interface's GetJobInputClip() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -4090,63 +1907,6 @@ type JobInputClip struct { Start ClipTimeClassification `json:"start,omitempty"` } -// GetJobInput implements the JobInputClassification interface for type JobInputClip. -func (j *JobInputClip) GetJobInput() *JobInput { - return &JobInput{ - ODataType: j.ODataType, - } -} - -// GetJobInputClip implements the JobInputClipClassification interface for type JobInputClip. -func (j *JobInputClip) GetJobInputClip() *JobInputClip { return j } - -// MarshalJSON implements the json.Marshaller interface for type JobInputClip. -func (j JobInputClip) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "end", j.End) - populate(objectMap, "files", j.Files) - populate(objectMap, "inputDefinitions", j.InputDefinitions) - populate(objectMap, "label", j.Label) - objectMap["@odata.type"] = "#Microsoft.Media.JobInputClip" - populate(objectMap, "start", j.Start) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputClip. -func (j *JobInputClip) 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 "end": - j.End, err = unmarshalClipTimeClassification(val) - delete(rawMsg, key) - case "files": - err = unpopulate(val, &j.Files) - delete(rawMsg, key) - case "inputDefinitions": - j.InputDefinitions, err = unmarshalInputDefinitionClassificationArray(val) - delete(rawMsg, key) - case "label": - err = unpopulate(val, &j.Label) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &j.ODataType) - delete(rawMsg, key) - case "start": - j.Start, err = unmarshalClipTimeClassification(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // JobInputHTTP - Represents HTTPS job input. type JobInputHTTP struct { // REQUIRED; The discriminator for derived types. @@ -4178,76 +1938,6 @@ type JobInputHTTP struct { Start ClipTimeClassification `json:"start,omitempty"` } -// GetJobInput implements the JobInputClassification interface for type JobInputHTTP. -func (j *JobInputHTTP) GetJobInput() *JobInput { - return &JobInput{ - ODataType: j.ODataType, - } -} - -// GetJobInputClip implements the JobInputClipClassification interface for type JobInputHTTP. -func (j *JobInputHTTP) GetJobInputClip() *JobInputClip { - return &JobInputClip{ - Files: j.Files, - Start: j.Start, - End: j.End, - Label: j.Label, - InputDefinitions: j.InputDefinitions, - ODataType: j.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type JobInputHTTP. -func (j JobInputHTTP) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "baseUri", j.BaseURI) - populate(objectMap, "end", j.End) - populate(objectMap, "files", j.Files) - populate(objectMap, "inputDefinitions", j.InputDefinitions) - populate(objectMap, "label", j.Label) - objectMap["@odata.type"] = "#Microsoft.Media.JobInputHttp" - populate(objectMap, "start", j.Start) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputHTTP. -func (j *JobInputHTTP) 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 "baseUri": - err = unpopulate(val, &j.BaseURI) - delete(rawMsg, key) - case "end": - j.End, err = unmarshalClipTimeClassification(val) - delete(rawMsg, key) - case "files": - err = unpopulate(val, &j.Files) - delete(rawMsg, key) - case "inputDefinitions": - j.InputDefinitions, err = unmarshalInputDefinitionClassificationArray(val) - delete(rawMsg, key) - case "label": - err = unpopulate(val, &j.Label) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &j.ODataType) - delete(rawMsg, key) - case "start": - j.Start, err = unmarshalClipTimeClassification(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // JobInputSequence - A Sequence contains an ordered list of Clips where each clip is a JobInput. The Sequence will be treated // as a single input. type JobInputSequence struct { @@ -4258,44 +1948,6 @@ type JobInputSequence struct { Inputs []JobInputClipClassification `json:"inputs,omitempty"` } -// GetJobInput implements the JobInputClassification interface for type JobInputSequence. -func (j *JobInputSequence) GetJobInput() *JobInput { - return &JobInput{ - ODataType: j.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type JobInputSequence. -func (j JobInputSequence) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "inputs", j.Inputs) - objectMap["@odata.type"] = "#Microsoft.Media.JobInputSequence" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputSequence. -func (j *JobInputSequence) 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 "inputs": - j.Inputs, err = unmarshalJobInputClipClassificationArray(val) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &j.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // JobInputs - Describes a list of inputs to a Job. type JobInputs struct { // REQUIRED; The discriminator for derived types. @@ -4305,44 +1957,6 @@ type JobInputs struct { Inputs []JobInputClassification `json:"inputs,omitempty"` } -// GetJobInput implements the JobInputClassification interface for type JobInputs. -func (j *JobInputs) GetJobInput() *JobInput { - return &JobInput{ - ODataType: j.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type JobInputs. -func (j JobInputs) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "inputs", j.Inputs) - objectMap["@odata.type"] = "#Microsoft.Media.JobInputs" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputs. -func (j *JobInputs) 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 "inputs": - j.Inputs, err = unmarshalJobInputClassificationArray(val) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &j.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // JobOutputClassification provides polymorphic access to related types. // Call the interface's GetJobOutput() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -4389,64 +2003,6 @@ type JobOutput struct { State *JobState `json:"state,omitempty" azure:"ro"` } -// GetJobOutput implements the JobOutputClassification interface for type JobOutput. -func (j *JobOutput) GetJobOutput() *JobOutput { return j } - -// MarshalJSON implements the json.Marshaller interface for type JobOutput. -func (j JobOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "endTime", j.EndTime) - populate(objectMap, "error", j.Error) - populate(objectMap, "label", j.Label) - objectMap["@odata.type"] = j.ODataType - populate(objectMap, "presetOverride", j.PresetOverride) - populate(objectMap, "progress", j.Progress) - populateTimeRFC3339(objectMap, "startTime", j.StartTime) - populate(objectMap, "state", j.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JobOutput. -func (j *JobOutput) 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 "endTime": - err = unpopulateTimeRFC3339(val, &j.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, &j.Error) - delete(rawMsg, key) - case "label": - err = unpopulate(val, &j.Label) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &j.ODataType) - delete(rawMsg, key) - case "presetOverride": - j.PresetOverride, err = unmarshalPresetClassification(val) - delete(rawMsg, key) - case "progress": - err = unpopulate(val, &j.Progress) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &j.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, &j.State) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // JobOutputAsset - Represents an Asset used as a JobOutput. type JobOutputAsset struct { // REQUIRED; The name of the output Asset. @@ -4487,79 +2043,6 @@ type JobOutputAsset struct { State *JobState `json:"state,omitempty" azure:"ro"` } -// GetJobOutput implements the JobOutputClassification interface for type JobOutputAsset. -func (j *JobOutputAsset) GetJobOutput() *JobOutput { - return &JobOutput{ - ODataType: j.ODataType, - Error: j.Error, - PresetOverride: j.PresetOverride, - State: j.State, - Progress: j.Progress, - Label: j.Label, - StartTime: j.StartTime, - EndTime: j.EndTime, - } -} - -// MarshalJSON implements the json.Marshaller interface for type JobOutputAsset. -func (j JobOutputAsset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assetName", j.AssetName) - populateTimeRFC3339(objectMap, "endTime", j.EndTime) - populate(objectMap, "error", j.Error) - populate(objectMap, "label", j.Label) - objectMap["@odata.type"] = "#Microsoft.Media.JobOutputAsset" - populate(objectMap, "presetOverride", j.PresetOverride) - populate(objectMap, "progress", j.Progress) - populateTimeRFC3339(objectMap, "startTime", j.StartTime) - populate(objectMap, "state", j.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JobOutputAsset. -func (j *JobOutputAsset) 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 "assetName": - err = unpopulate(val, &j.AssetName) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, &j.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, &j.Error) - delete(rawMsg, key) - case "label": - err = unpopulate(val, &j.Label) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &j.ODataType) - delete(rawMsg, key) - case "presetOverride": - j.PresetOverride, err = unmarshalPresetClassification(val) - delete(rawMsg, key) - case "progress": - err = unpopulate(val, &j.Progress) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &j.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, &j.State) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // JobProperties - Properties of the Job. type JobProperties struct { // REQUIRED; The inputs for the Job. @@ -4594,69 +2077,6 @@ type JobProperties struct { State *JobState `json:"state,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type JobProperties. -func (j JobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "correlationData", j.CorrelationData) - populateTimeRFC3339(objectMap, "created", j.Created) - populate(objectMap, "description", j.Description) - populateTimeRFC3339(objectMap, "endTime", j.EndTime) - populate(objectMap, "input", j.Input) - populateTimeRFC3339(objectMap, "lastModified", j.LastModified) - populate(objectMap, "outputs", j.Outputs) - populate(objectMap, "priority", j.Priority) - populateTimeRFC3339(objectMap, "startTime", j.StartTime) - populate(objectMap, "state", j.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JobProperties. -func (j *JobProperties) 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 "correlationData": - err = unpopulate(val, &j.CorrelationData) - delete(rawMsg, key) - case "created": - err = unpopulateTimeRFC3339(val, &j.Created) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &j.Description) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, &j.EndTime) - delete(rawMsg, key) - case "input": - j.Input, err = unmarshalJobInputClassification(val) - delete(rawMsg, key) - case "lastModified": - err = unpopulateTimeRFC3339(val, &j.LastModified) - delete(rawMsg, key) - case "outputs": - j.Outputs, err = unmarshalJobOutputClassificationArray(val) - delete(rawMsg, key) - case "priority": - err = unpopulate(val, &j.Priority) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &j.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, &j.State) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // JobsClientCancelJobOptions contains the optional parameters for the JobsClient.CancelJob method. type JobsClientCancelJobOptions struct { // placeholder for future optional parameters @@ -4707,53 +2127,6 @@ type JpgFormat struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetFormat implements the FormatClassification interface for type JpgFormat. -func (j *JpgFormat) GetFormat() *Format { - return &Format{ - ODataType: j.ODataType, - FilenamePattern: j.FilenamePattern, - } -} - -// GetImageFormat implements the ImageFormatClassification interface for type JpgFormat. -func (j *JpgFormat) GetImageFormat() *ImageFormat { - return &ImageFormat{ - ODataType: j.ODataType, - FilenamePattern: j.FilenamePattern, - } -} - -// MarshalJSON implements the json.Marshaller interface for type JpgFormat. -func (j JpgFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filenamePattern", j.FilenamePattern) - objectMap["@odata.type"] = "#Microsoft.Media.JpgFormat" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JpgFormat. -func (j *JpgFormat) 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 "filenamePattern": - err = unpopulate(val, &j.FilenamePattern) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &j.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // JpgImage - Describes the properties for producing a series of JPEG images from the input video. type JpgImage struct { // REQUIRED; The discriminator for derived types. @@ -4810,102 +2183,6 @@ type JpgImage struct { SyncMode *VideoSyncMode `json:"syncMode,omitempty"` } -// GetCodec implements the CodecClassification interface for type JpgImage. -func (j *JpgImage) GetCodec() *Codec { - return &Codec{ - ODataType: j.ODataType, - Label: j.Label, - } -} - -// GetImage implements the ImageClassification interface for type JpgImage. -func (j *JpgImage) GetImage() *Image { - return &Image{ - Start: j.Start, - Step: j.Step, - Range: j.Range, - KeyFrameInterval: j.KeyFrameInterval, - StretchMode: j.StretchMode, - SyncMode: j.SyncMode, - ODataType: j.ODataType, - Label: j.Label, - } -} - -// GetVideo implements the VideoClassification interface for type JpgImage. -func (j *JpgImage) GetVideo() *Video { - return &Video{ - KeyFrameInterval: j.KeyFrameInterval, - StretchMode: j.StretchMode, - SyncMode: j.SyncMode, - ODataType: j.ODataType, - Label: j.Label, - } -} - -// MarshalJSON implements the json.Marshaller interface for type JpgImage. -func (j JpgImage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "keyFrameInterval", j.KeyFrameInterval) - populate(objectMap, "label", j.Label) - populate(objectMap, "layers", j.Layers) - objectMap["@odata.type"] = "#Microsoft.Media.JpgImage" - populate(objectMap, "range", j.Range) - populate(objectMap, "spriteColumn", j.SpriteColumn) - populate(objectMap, "start", j.Start) - populate(objectMap, "step", j.Step) - populate(objectMap, "stretchMode", j.StretchMode) - populate(objectMap, "syncMode", j.SyncMode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JpgImage. -func (j *JpgImage) 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 "keyFrameInterval": - err = unpopulate(val, &j.KeyFrameInterval) - delete(rawMsg, key) - case "label": - err = unpopulate(val, &j.Label) - delete(rawMsg, key) - case "layers": - err = unpopulate(val, &j.Layers) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &j.ODataType) - delete(rawMsg, key) - case "range": - err = unpopulate(val, &j.Range) - delete(rawMsg, key) - case "spriteColumn": - err = unpopulate(val, &j.SpriteColumn) - delete(rawMsg, key) - case "start": - err = unpopulate(val, &j.Start) - delete(rawMsg, key) - case "step": - err = unpopulate(val, &j.Step) - delete(rawMsg, key) - case "stretchMode": - err = unpopulate(val, &j.StretchMode) - delete(rawMsg, key) - case "syncMode": - err = unpopulate(val, &j.SyncMode) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // JpgLayer - Describes the settings to produce a JPEG image from the input video. type JpgLayer struct { // The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example @@ -4965,50 +2242,12 @@ type ListContainerSasInput struct { Permissions *AssetContainerPermission `json:"permissions,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ListContainerSasInput. -func (l ListContainerSasInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "expiryTime", l.ExpiryTime) - populate(objectMap, "permissions", l.Permissions) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ListContainerSasInput. -func (l *ListContainerSasInput) 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 "expiryTime": - err = unpopulateTimeRFC3339(val, &l.ExpiryTime) - delete(rawMsg, key) - case "permissions": - err = unpopulate(val, &l.Permissions) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ListContentKeysResponse - Class of response for listContentKeys action type ListContentKeysResponse struct { // ContentKeys used by current Streaming Locator ContentKeys []*StreamingLocatorContentKey `json:"contentKeys,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ListContentKeysResponse. -func (l ListContentKeysResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "contentKeys", l.ContentKeys) - return json.Marshal(objectMap) -} - type ListEdgePoliciesInput struct { // Unique identifier of the edge device. DeviceID *string `json:"deviceId,omitempty"` @@ -5023,27 +2262,12 @@ type ListPathsResponse struct { StreamingPaths []*StreamingPath `json:"streamingPaths,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ListPathsResponse. -func (l ListPathsResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "downloadPaths", l.DownloadPaths) - populate(objectMap, "streamingPaths", l.StreamingPaths) - return json.Marshal(objectMap) -} - // ListStreamingLocatorsResponse - The Streaming Locators associated with this Asset. type ListStreamingLocatorsResponse struct { // READ-ONLY; The list of Streaming Locators. StreamingLocators []*AssetStreamingLocator `json:"streamingLocators,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ListStreamingLocatorsResponse. -func (l ListStreamingLocatorsResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "streamingLocators", l.StreamingLocators) - return json.Marshal(objectMap) -} - // LiveEvent - The live event. type LiveEvent struct { // REQUIRED; The geo-location where the resource lives @@ -5068,19 +2292,6 @@ type LiveEvent struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type LiveEvent. -func (l LiveEvent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", l.ID) - populate(objectMap, "location", l.Location) - populate(objectMap, "name", l.Name) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "systemData", l.SystemData) - populate(objectMap, "tags", l.Tags) - populate(objectMap, "type", l.Type) - return json.Marshal(objectMap) -} - // LiveEventActionInput - The LiveEvent action input parameter definition. type LiveEventActionInput struct { // The flag indicates whether live outputs are automatically deleted when live event is being stopped. Deleting live outputs @@ -5143,17 +2354,6 @@ type LiveEventInput struct { KeyFrameIntervalDuration *string `json:"keyFrameIntervalDuration,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type LiveEventInput. -func (l LiveEventInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accessControl", l.AccessControl) - populate(objectMap, "accessToken", l.AccessToken) - populate(objectMap, "endpoints", l.Endpoints) - populate(objectMap, "keyFrameIntervalDuration", l.KeyFrameIntervalDuration) - populate(objectMap, "streamingProtocol", l.StreamingProtocol) - return json.Marshal(objectMap) -} - // LiveEventInputAccessControl - The IP access control for live event input. type LiveEventInputAccessControl struct { // The IP access control properties. @@ -5185,15 +2385,6 @@ type LiveEventListResult struct { Value []*LiveEvent `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type LiveEventListResult. -func (l LiveEventListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@odata.count", l.ODataCount) - populate(objectMap, "@odata.nextLink", l.ODataNextLink) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - // LiveEventOutputTranscriptionTrack - Describes a transcription track in the output of a live event, generated using speech-to-text // transcription. This property is reserved for future use, any value set on this property will be ignored. type LiveEventOutputTranscriptionTrack struct { @@ -5224,17 +2415,6 @@ type LiveEventPreview struct { StreamingPolicyName *string `json:"streamingPolicyName,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type LiveEventPreview. -func (l LiveEventPreview) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accessControl", l.AccessControl) - populate(objectMap, "alternativeMediaId", l.AlternativeMediaID) - populate(objectMap, "endpoints", l.Endpoints) - populate(objectMap, "previewLocator", l.PreviewLocator) - populate(objectMap, "streamingPolicyName", l.StreamingPolicyName) - return json.Marshal(objectMap) -} - // LiveEventPreviewAccessControl - The IP access control for the live event preview endpoint. type LiveEventPreviewAccessControl struct { // The IP access control properties. @@ -5290,81 +2470,6 @@ type LiveEventProperties struct { ResourceState *LiveEventResourceState `json:"resourceState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type LiveEventProperties. -func (l LiveEventProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) - populateTimeRFC3339(objectMap, "lastModified", l.LastModified) - populate(objectMap, "preview", l.Preview) - populate(objectMap, "provisioningState", l.ProvisioningState) - populate(objectMap, "resourceState", l.ResourceState) - populate(objectMap, "streamOptions", l.StreamOptions) - populate(objectMap, "transcriptions", l.Transcriptions) - populate(objectMap, "useStaticHostname", l.UseStaticHostname) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LiveEventProperties. -func (l *LiveEventProperties) 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 "created": - err = unpopulateTimeRFC3339(val, &l.Created) - delete(rawMsg, key) - case "crossSiteAccessPolicies": - err = unpopulate(val, &l.CrossSiteAccessPolicies) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &l.Description) - delete(rawMsg, key) - case "encoding": - err = unpopulate(val, &l.Encoding) - delete(rawMsg, key) - case "hostnamePrefix": - err = unpopulate(val, &l.HostnamePrefix) - delete(rawMsg, key) - case "input": - err = unpopulate(val, &l.Input) - delete(rawMsg, key) - case "lastModified": - err = unpopulateTimeRFC3339(val, &l.LastModified) - delete(rawMsg, key) - case "preview": - err = unpopulate(val, &l.Preview) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &l.ProvisioningState) - delete(rawMsg, key) - case "resourceState": - err = unpopulate(val, &l.ResourceState) - delete(rawMsg, key) - case "streamOptions": - err = unpopulate(val, &l.StreamOptions) - delete(rawMsg, key) - case "transcriptions": - err = unpopulate(val, &l.Transcriptions) - delete(rawMsg, key) - case "useStaticHostname": - err = unpopulate(val, &l.UseStaticHostname) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // LiveEventTranscription - Describes the transcription tracks in the output of a live event, generated using speech-to-text // transcription. This property is reserved for future use, any value set on this property will be // ignored. @@ -5385,49 +2490,48 @@ type LiveEventTranscription struct { OutputTranscriptionTrack *LiveEventOutputTranscriptionTrack `json:"outputTranscriptionTrack,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type LiveEventTranscription. -func (l LiveEventTranscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "inputTrackSelection", l.InputTrackSelection) - populate(objectMap, "language", l.Language) - populate(objectMap, "outputTranscriptionTrack", l.OutputTranscriptionTrack) - return json.Marshal(objectMap) -} - // LiveEventsClientBeginAllocateOptions contains the optional parameters for the LiveEventsClient.BeginAllocate method. type LiveEventsClientBeginAllocateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // LiveEventsClientBeginCreateOptions contains the optional parameters for the LiveEventsClient.BeginCreate method. type LiveEventsClientBeginCreateOptions struct { // The flag indicates if the resource should be automatically started on creation. AutoStart *bool + // Resumes the LRO from the provided token. + ResumeToken string } // LiveEventsClientBeginDeleteOptions contains the optional parameters for the LiveEventsClient.BeginDelete method. type LiveEventsClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // LiveEventsClientBeginResetOptions contains the optional parameters for the LiveEventsClient.BeginReset method. type LiveEventsClientBeginResetOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // LiveEventsClientBeginStartOptions contains the optional parameters for the LiveEventsClient.BeginStart method. type LiveEventsClientBeginStartOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // LiveEventsClientBeginStopOptions contains the optional parameters for the LiveEventsClient.BeginStop method. type LiveEventsClientBeginStopOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // LiveEventsClientBeginUpdateOptions contains the optional parameters for the LiveEventsClient.BeginUpdate method. type LiveEventsClientBeginUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // LiveEventsClientGetOptions contains the optional parameters for the LiveEventsClient.Get method. @@ -5470,15 +2574,6 @@ type LiveOutputListResult struct { Value []*LiveOutput `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type LiveOutputListResult. -func (l LiveOutputListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@odata.count", l.ODataCount) - populate(objectMap, "@odata.nextLink", l.ODataNextLink) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - // LiveOutputProperties - The JSON object that contains the properties required to create a live output. type LiveOutputProperties struct { // REQUIRED; ISO 8601 time between 1 minute to 25 hours to indicate the maximum content length that can be archived in the @@ -5514,77 +2609,16 @@ type LiveOutputProperties struct { ResourceState *LiveOutputResourceState `json:"resourceState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type LiveOutputProperties. -func (l LiveOutputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "archiveWindowLength", l.ArchiveWindowLength) - populate(objectMap, "assetName", l.AssetName) - populateTimeRFC3339(objectMap, "created", l.Created) - populate(objectMap, "description", l.Description) - populate(objectMap, "hls", l.Hls) - populateTimeRFC3339(objectMap, "lastModified", l.LastModified) - populate(objectMap, "manifestName", l.ManifestName) - populate(objectMap, "outputSnapTime", l.OutputSnapTime) - populate(objectMap, "provisioningState", l.ProvisioningState) - populate(objectMap, "resourceState", l.ResourceState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LiveOutputProperties. -func (l *LiveOutputProperties) 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 "archiveWindowLength": - err = unpopulate(val, &l.ArchiveWindowLength) - delete(rawMsg, key) - case "assetName": - err = unpopulate(val, &l.AssetName) - delete(rawMsg, key) - case "created": - err = unpopulateTimeRFC3339(val, &l.Created) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &l.Description) - delete(rawMsg, key) - case "hls": - err = unpopulate(val, &l.Hls) - delete(rawMsg, key) - case "lastModified": - err = unpopulateTimeRFC3339(val, &l.LastModified) - delete(rawMsg, key) - case "manifestName": - err = unpopulate(val, &l.ManifestName) - delete(rawMsg, key) - case "outputSnapTime": - err = unpopulate(val, &l.OutputSnapTime) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &l.ProvisioningState) - delete(rawMsg, key) - case "resourceState": - err = unpopulate(val, &l.ResourceState) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // LiveOutputsClientBeginCreateOptions contains the optional parameters for the LiveOutputsClient.BeginCreate method. type LiveOutputsClientBeginCreateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // LiveOutputsClientBeginDeleteOptions contains the optional parameters for the LiveOutputsClient.BeginDelete method. type LiveOutputsClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // LiveOutputsClientGetOptions contains the optional parameters for the LiveOutputsClient.Get method. @@ -5627,15 +2661,6 @@ type MediaFilterProperties struct { Tracks []*FilterTrackSelection `json:"tracks,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type MediaFilterProperties. -func (m MediaFilterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "firstQuality", m.FirstQuality) - populate(objectMap, "presentationTimeRange", m.PresentationTimeRange) - populate(objectMap, "tracks", m.Tracks) - return json.Marshal(objectMap) -} - // MediaService - A Media Services account. type MediaService struct { // REQUIRED; The geo-location where the resource lives @@ -5663,20 +2688,6 @@ type MediaService struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type MediaService. -func (m MediaService) MarshalJSON() ([]byte, error) { - objectMap := make(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, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - // MediaServiceCollection - A collection of MediaService items. type MediaServiceCollection struct { // A link to the next page of the collection (when the collection contains too many results to return in one response). @@ -5686,14 +2697,6 @@ type MediaServiceCollection struct { Value []*MediaService `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type MediaServiceCollection. -func (m MediaServiceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@odata.nextLink", m.ODataNextLink) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - type MediaServiceIdentity struct { // REQUIRED; The identity type. Type *string `json:"type,omitempty"` @@ -5708,16 +2711,6 @@ type MediaServiceIdentity struct { TenantID *string `json:"tenantId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type MediaServiceIdentity. -func (m MediaServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", m.PrincipalID) - populate(objectMap, "tenantId", m.TenantID) - populate(objectMap, "type", m.Type) - populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) - return json.Marshal(objectMap) -} - // MediaServiceProperties - Properties of the Media Services account. type MediaServiceProperties struct { // The account encryption properties. @@ -5737,18 +2730,6 @@ type MediaServiceProperties struct { MediaServiceID *string `json:"mediaServiceId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type MediaServiceProperties. -func (m MediaServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "encryption", m.Encryption) - populate(objectMap, "keyDelivery", m.KeyDelivery) - populate(objectMap, "mediaServiceId", m.MediaServiceID) - populate(objectMap, "publicNetworkAccess", m.PublicNetworkAccess) - populate(objectMap, "storageAccounts", m.StorageAccounts) - populate(objectMap, "storageAuthentication", m.StorageAuthentication) - return json.Marshal(objectMap) -} - // MediaServiceUpdate - A Media Services account update. type MediaServiceUpdate struct { // The Managed Identity for the Media Services account. @@ -5761,15 +2742,6 @@ type MediaServiceUpdate struct { Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type MediaServiceUpdate. -func (m MediaServiceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", m.Identity) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - return json.Marshal(objectMap) -} - // MetricDimension - A metric dimension. type MetricDimension struct { // READ-ONLY; The display name for the dimension. @@ -5821,24 +2793,6 @@ type MetricSpecification struct { Unit *MetricUnit `json:"unit,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. -func (m MetricSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregationType", m.AggregationType) - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "displayDescription", m.DisplayDescription) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "enableRegionalMdmAccount", m.EnableRegionalMdmAccount) - populate(objectMap, "lockAggregationType", m.LockAggregationType) - populate(objectMap, "name", m.Name) - populate(objectMap, "sourceMdmAccount", m.SourceMdmAccount) - populate(objectMap, "sourceMdmNamespace", m.SourceMdmNamespace) - populate(objectMap, "supportedAggregationTypes", m.SupportedAggregationTypes) - populate(objectMap, "supportedTimeGrainTypes", m.SupportedTimeGrainTypes) - populate(objectMap, "unit", m.Unit) - return json.Marshal(objectMap) -} - // Mp4Format - Describes the properties for an output ISO MP4 file. type Mp4Format struct { // REQUIRED; The pattern of the file names for the generated output files. The following macros are supported in the file @@ -5860,58 +2814,6 @@ type Mp4Format struct { OutputFiles []*OutputFile `json:"outputFiles,omitempty"` } -// GetFormat implements the FormatClassification interface for type Mp4Format. -func (m *Mp4Format) GetFormat() *Format { - return &Format{ - ODataType: m.ODataType, - FilenamePattern: m.FilenamePattern, - } -} - -// GetMultiBitrateFormat implements the MultiBitrateFormatClassification interface for type Mp4Format. -func (m *Mp4Format) GetMultiBitrateFormat() *MultiBitrateFormat { - return &MultiBitrateFormat{ - OutputFiles: m.OutputFiles, - ODataType: m.ODataType, - FilenamePattern: m.FilenamePattern, - } -} - -// MarshalJSON implements the json.Marshaller interface for type Mp4Format. -func (m Mp4Format) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filenamePattern", m.FilenamePattern) - objectMap["@odata.type"] = "#Microsoft.Media.Mp4Format" - populate(objectMap, "outputFiles", m.OutputFiles) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Mp4Format. -func (m *Mp4Format) 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 "filenamePattern": - err = unpopulate(val, &m.FilenamePattern) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &m.ODataType) - delete(rawMsg, key) - case "outputFiles": - err = unpopulate(val, &m.OutputFiles) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // MultiBitrateFormatClassification provides polymorphic access to related types. // Call the interface's GetMultiBitrateFormat() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -5945,52 +2847,6 @@ type MultiBitrateFormat struct { OutputFiles []*OutputFile `json:"outputFiles,omitempty"` } -// GetFormat implements the FormatClassification interface for type MultiBitrateFormat. -func (m *MultiBitrateFormat) GetFormat() *Format { - return &Format{ - ODataType: m.ODataType, - FilenamePattern: m.FilenamePattern, - } -} - -// GetMultiBitrateFormat implements the MultiBitrateFormatClassification interface for type MultiBitrateFormat. -func (m *MultiBitrateFormat) GetMultiBitrateFormat() *MultiBitrateFormat { return m } - -// MarshalJSON implements the json.Marshaller interface for type MultiBitrateFormat. -func (m MultiBitrateFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filenamePattern", m.FilenamePattern) - objectMap["@odata.type"] = "#Microsoft.Media.MultiBitrateFormat" - populate(objectMap, "outputFiles", m.OutputFiles) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MultiBitrateFormat. -func (m *MultiBitrateFormat) 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 "filenamePattern": - err = unpopulate(val, &m.FilenamePattern) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &m.ODataType) - delete(rawMsg, key) - case "outputFiles": - err = unpopulate(val, &m.OutputFiles) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // NoEncryption - Class for NoEncryption scheme type NoEncryption struct { // Representing supported protocols @@ -6024,13 +2880,6 @@ type OperationCollection struct { Value []*Operation `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OperationCollection. -func (o OperationCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationDisplay - Operation details. type OperationDisplay struct { // The operation description. @@ -6070,13 +2919,6 @@ type OutputFile struct { Labels []*string `json:"labels,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OutputFile. -func (o OutputFile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "labels", o.Labels) - return json.Marshal(objectMap) -} - // OverlayClassification provides polymorphic access to related types. // Call the interface's GetOverlay() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -6121,9 +2963,6 @@ type Overlay struct { Start *string `json:"start,omitempty"` } -// GetOverlay implements the OverlayClassification interface for type Overlay. -func (o *Overlay) GetOverlay() *Overlay { return o } - // PNGFormat - Describes the settings for producing PNG thumbnails. type PNGFormat struct { // REQUIRED; The pattern of the file names for the generated output files. The following macros are supported in the file @@ -6141,53 +2980,6 @@ type PNGFormat struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetFormat implements the FormatClassification interface for type PNGFormat. -func (p *PNGFormat) GetFormat() *Format { - return &Format{ - ODataType: p.ODataType, - FilenamePattern: p.FilenamePattern, - } -} - -// GetImageFormat implements the ImageFormatClassification interface for type PNGFormat. -func (p *PNGFormat) GetImageFormat() *ImageFormat { - return &ImageFormat{ - ODataType: p.ODataType, - FilenamePattern: p.FilenamePattern, - } -} - -// MarshalJSON implements the json.Marshaller interface for type PNGFormat. -func (p PNGFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filenamePattern", p.FilenamePattern) - objectMap["@odata.type"] = "#Microsoft.Media.PngFormat" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PNGFormat. -func (p *PNGFormat) 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 "filenamePattern": - err = unpopulate(val, &p.FilenamePattern) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &p.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // PNGImage - Describes the properties for producing a series of PNG images from the input video. type PNGImage struct { // REQUIRED; The discriminator for derived types. @@ -6238,98 +3030,6 @@ type PNGImage struct { SyncMode *VideoSyncMode `json:"syncMode,omitempty"` } -// GetCodec implements the CodecClassification interface for type PNGImage. -func (p *PNGImage) GetCodec() *Codec { - return &Codec{ - ODataType: p.ODataType, - Label: p.Label, - } -} - -// GetImage implements the ImageClassification interface for type PNGImage. -func (p *PNGImage) GetImage() *Image { - return &Image{ - Start: p.Start, - Step: p.Step, - Range: p.Range, - KeyFrameInterval: p.KeyFrameInterval, - StretchMode: p.StretchMode, - SyncMode: p.SyncMode, - ODataType: p.ODataType, - Label: p.Label, - } -} - -// GetVideo implements the VideoClassification interface for type PNGImage. -func (p *PNGImage) GetVideo() *Video { - return &Video{ - KeyFrameInterval: p.KeyFrameInterval, - StretchMode: p.StretchMode, - SyncMode: p.SyncMode, - ODataType: p.ODataType, - Label: p.Label, - } -} - -// MarshalJSON implements the json.Marshaller interface for type PNGImage. -func (p PNGImage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "keyFrameInterval", p.KeyFrameInterval) - populate(objectMap, "label", p.Label) - populate(objectMap, "layers", p.Layers) - objectMap["@odata.type"] = "#Microsoft.Media.PngImage" - populate(objectMap, "range", p.Range) - populate(objectMap, "start", p.Start) - populate(objectMap, "step", p.Step) - populate(objectMap, "stretchMode", p.StretchMode) - populate(objectMap, "syncMode", p.SyncMode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PNGImage. -func (p *PNGImage) 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 "keyFrameInterval": - err = unpopulate(val, &p.KeyFrameInterval) - delete(rawMsg, key) - case "label": - err = unpopulate(val, &p.Label) - delete(rawMsg, key) - case "layers": - err = unpopulate(val, &p.Layers) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &p.ODataType) - delete(rawMsg, key) - case "range": - err = unpopulate(val, &p.Range) - delete(rawMsg, key) - case "start": - err = unpopulate(val, &p.Start) - delete(rawMsg, key) - case "step": - err = unpopulate(val, &p.Step) - delete(rawMsg, key) - case "stretchMode": - err = unpopulate(val, &p.StretchMode) - delete(rawMsg, key) - case "syncMode": - err = unpopulate(val, &p.SyncMode) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // PNGLayer - Describes the settings to produce a PNG image from the input video. type PNGLayer struct { // The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example @@ -6381,9 +3081,6 @@ type Preset struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetPreset implements the PresetClassification interface for type Preset. -func (p *Preset) GetPreset() *Preset { return p } - // PresetConfigurations - An object of optional configuration settings for encoder. type PresetConfigurations struct { // Allows you to configure the encoder settings to control the balance between speed and quality. Example: set Complexity @@ -6447,13 +3144,6 @@ type PrivateEndpointConnectionListResult struct { Value []*PrivateEndpointConnection `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. -func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. type PrivateEndpointConnectionProperties struct { // REQUIRED; A collection of information about the state of the connection between service consumer and provider. @@ -6511,13 +3201,6 @@ type PrivateLinkResourceListResult struct { Value []*PrivateLinkResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. -func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PrivateLinkResourceProperties - Properties of a private link resource. type PrivateLinkResourceProperties struct { // The private link resource Private link DNS zone name. @@ -6530,15 +3213,6 @@ type PrivateLinkResourceProperties struct { RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) - return json.Marshal(objectMap) -} - // PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. type PrivateLinkResourcesClientGetOptions struct { // placeholder for future optional parameters @@ -6639,64 +3313,6 @@ type SelectAudioTrackByAttribute struct { FilterValue *string `json:"filterValue,omitempty"` } -// GetAudioTrackDescriptor implements the AudioTrackDescriptorClassification interface for type SelectAudioTrackByAttribute. -func (s *SelectAudioTrackByAttribute) GetAudioTrackDescriptor() *AudioTrackDescriptor { - return &AudioTrackDescriptor{ - ChannelMapping: s.ChannelMapping, - ODataType: s.ODataType, - } -} - -// GetTrackDescriptor implements the TrackDescriptorClassification interface for type SelectAudioTrackByAttribute. -func (s *SelectAudioTrackByAttribute) GetTrackDescriptor() *TrackDescriptor { - return &TrackDescriptor{ - ODataType: s.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type SelectAudioTrackByAttribute. -func (s SelectAudioTrackByAttribute) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "attribute", s.Attribute) - populate(objectMap, "channelMapping", s.ChannelMapping) - populate(objectMap, "filter", s.Filter) - populate(objectMap, "filterValue", s.FilterValue) - objectMap["@odata.type"] = "#Microsoft.Media.SelectAudioTrackByAttribute" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SelectAudioTrackByAttribute. -func (s *SelectAudioTrackByAttribute) 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 "attribute": - err = unpopulate(val, &s.Attribute) - delete(rawMsg, key) - case "channelMapping": - err = unpopulate(val, &s.ChannelMapping) - delete(rawMsg, key) - case "filter": - err = unpopulate(val, &s.Filter) - delete(rawMsg, key) - case "filterValue": - err = unpopulate(val, &s.FilterValue) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &s.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // SelectAudioTrackByID - Select audio tracks from the input by specifying a track identifier. type SelectAudioTrackByID struct { // REQUIRED; The discriminator for derived types. @@ -6710,56 +3326,6 @@ type SelectAudioTrackByID struct { ChannelMapping *ChannelMapping `json:"channelMapping,omitempty"` } -// GetAudioTrackDescriptor implements the AudioTrackDescriptorClassification interface for type SelectAudioTrackByID. -func (s *SelectAudioTrackByID) GetAudioTrackDescriptor() *AudioTrackDescriptor { - return &AudioTrackDescriptor{ - ChannelMapping: s.ChannelMapping, - ODataType: s.ODataType, - } -} - -// GetTrackDescriptor implements the TrackDescriptorClassification interface for type SelectAudioTrackByID. -func (s *SelectAudioTrackByID) GetTrackDescriptor() *TrackDescriptor { - return &TrackDescriptor{ - ODataType: s.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type SelectAudioTrackByID. -func (s SelectAudioTrackByID) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "channelMapping", s.ChannelMapping) - objectMap["@odata.type"] = "#Microsoft.Media.SelectAudioTrackById" - populate(objectMap, "trackId", s.TrackID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SelectAudioTrackByID. -func (s *SelectAudioTrackByID) 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 "channelMapping": - err = unpopulate(val, &s.ChannelMapping) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &s.ODataType) - delete(rawMsg, key) - case "trackId": - err = unpopulate(val, &s.TrackID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // SelectVideoTrackByAttribute - Select video tracks from the input by specifying an attribute and an attribute filter. type SelectVideoTrackByAttribute struct { // REQUIRED; The TrackAttribute to filter the tracks by. @@ -6777,59 +3343,6 @@ type SelectVideoTrackByAttribute struct { FilterValue *string `json:"filterValue,omitempty"` } -// GetTrackDescriptor implements the TrackDescriptorClassification interface for type SelectVideoTrackByAttribute. -func (s *SelectVideoTrackByAttribute) GetTrackDescriptor() *TrackDescriptor { - return &TrackDescriptor{ - ODataType: s.ODataType, - } -} - -// GetVideoTrackDescriptor implements the VideoTrackDescriptorClassification interface for type SelectVideoTrackByAttribute. -func (s *SelectVideoTrackByAttribute) GetVideoTrackDescriptor() *VideoTrackDescriptor { - return &VideoTrackDescriptor{ - ODataType: s.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type SelectVideoTrackByAttribute. -func (s SelectVideoTrackByAttribute) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "attribute", s.Attribute) - populate(objectMap, "filter", s.Filter) - populate(objectMap, "filterValue", s.FilterValue) - objectMap["@odata.type"] = "#Microsoft.Media.SelectVideoTrackByAttribute" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SelectVideoTrackByAttribute. -func (s *SelectVideoTrackByAttribute) 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 "attribute": - err = unpopulate(val, &s.Attribute) - delete(rawMsg, key) - case "filter": - err = unpopulate(val, &s.Filter) - delete(rawMsg, key) - case "filterValue": - err = unpopulate(val, &s.FilterValue) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &s.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // SelectVideoTrackByID - Select video tracks from the input by specifying a track identifier. type SelectVideoTrackByID struct { // REQUIRED; The discriminator for derived types. @@ -6839,51 +3352,6 @@ type SelectVideoTrackByID struct { TrackID *int64 `json:"trackId,omitempty"` } -// GetTrackDescriptor implements the TrackDescriptorClassification interface for type SelectVideoTrackByID. -func (s *SelectVideoTrackByID) GetTrackDescriptor() *TrackDescriptor { - return &TrackDescriptor{ - ODataType: s.ODataType, - } -} - -// GetVideoTrackDescriptor implements the VideoTrackDescriptorClassification interface for type SelectVideoTrackByID. -func (s *SelectVideoTrackByID) GetVideoTrackDescriptor() *VideoTrackDescriptor { - return &VideoTrackDescriptor{ - ODataType: s.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type SelectVideoTrackByID. -func (s SelectVideoTrackByID) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["@odata.type"] = "#Microsoft.Media.SelectVideoTrackById" - populate(objectMap, "trackId", s.TrackID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SelectVideoTrackByID. -func (s *SelectVideoTrackByID) 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 "@odata.type": - err = unpopulate(val, &s.ODataType) - delete(rawMsg, key) - case "trackId": - err = unpopulate(val, &s.TrackID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ServiceSpecification - The service metric specifications. type ServiceSpecification struct { // READ-ONLY; List of log specifications. @@ -6893,14 +3361,6 @@ type ServiceSpecification struct { MetricSpecifications []*MetricSpecification `json:"metricSpecifications,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. -func (s ServiceSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "logSpecifications", s.LogSpecifications) - populate(objectMap, "metricSpecifications", s.MetricSpecifications) - return json.Marshal(objectMap) -} - // StandardEncoderPreset - Describes all the settings to be used when encoding the input video with the Standard Encoder. type StandardEncoderPreset struct { // REQUIRED; The list of codecs to be used when encoding the input video. @@ -6916,52 +3376,6 @@ type StandardEncoderPreset struct { Filters *Filters `json:"filters,omitempty"` } -// GetPreset implements the PresetClassification interface for type StandardEncoderPreset. -func (s *StandardEncoderPreset) GetPreset() *Preset { - return &Preset{ - ODataType: s.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type StandardEncoderPreset. -func (s StandardEncoderPreset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "codecs", s.Codecs) - populate(objectMap, "filters", s.Filters) - populate(objectMap, "formats", s.Formats) - objectMap["@odata.type"] = "#Microsoft.Media.StandardEncoderPreset" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StandardEncoderPreset. -func (s *StandardEncoderPreset) 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 "codecs": - s.Codecs, err = unmarshalCodecClassificationArray(val) - delete(rawMsg, key) - case "filters": - err = unpopulate(val, &s.Filters) - delete(rawMsg, key) - case "formats": - s.Formats, err = unmarshalFormatClassificationArray(val) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &s.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // StorageAccount - The storage account details. type StorageAccount struct { // REQUIRED; The type of the storage account. @@ -6988,37 +3402,6 @@ type StorageEncryptedAssetDecryptionData struct { Key []byte `json:"key,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type StorageEncryptedAssetDecryptionData. -func (s StorageEncryptedAssetDecryptionData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assetFileEncryptionMetadata", s.AssetFileEncryptionMetadata) - populateByteArray(objectMap, "key", s.Key, runtime.Base64StdFormat) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageEncryptedAssetDecryptionData. -func (s *StorageEncryptedAssetDecryptionData) 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 "assetFileEncryptionMetadata": - err = unpopulate(val, &s.AssetFileEncryptionMetadata) - delete(rawMsg, key) - case "key": - err = runtime.DecodeByteArray(string(val), &s.Key, runtime.Base64StdFormat) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // StreamingEndpoint - The streaming endpoint. type StreamingEndpoint struct { // REQUIRED; The geo-location where the resource lives @@ -7046,20 +3429,6 @@ type StreamingEndpoint struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type StreamingEndpoint. -func (s StreamingEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "sku", s.SKU) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - // StreamingEndpointAccessControl - Streaming endpoint access control definition. type StreamingEndpointAccessControl struct { // The access control of Akamai @@ -7081,15 +3450,6 @@ type StreamingEndpointListResult struct { Value []*StreamingEndpoint `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type StreamingEndpointListResult. -func (s StreamingEndpointListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@odata.count", s.ODataCount) - populate(objectMap, "@odata.nextLink", s.ODataNextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - // StreamingEndpointProperties - The streaming endpoint properties. type StreamingEndpointProperties struct { // REQUIRED; The number of scale units. Use the Scale operation to adjust this value. @@ -7141,139 +3501,52 @@ type StreamingEndpointProperties struct { ResourceState *StreamingEndpointResourceState `json:"resourceState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type StreamingEndpointProperties. -func (s StreamingEndpointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accessControl", s.AccessControl) - populate(objectMap, "availabilitySetName", s.AvailabilitySetName) - populate(objectMap, "cdnEnabled", s.CdnEnabled) - populate(objectMap, "cdnProfile", s.CdnProfile) - populate(objectMap, "cdnProvider", s.CdnProvider) - populateTimeRFC3339(objectMap, "created", s.Created) - populate(objectMap, "crossSiteAccessPolicies", s.CrossSiteAccessPolicies) - populate(objectMap, "customHostNames", s.CustomHostNames) - populate(objectMap, "description", s.Description) - populateTimeRFC3339(objectMap, "freeTrialEndTime", s.FreeTrialEndTime) - populate(objectMap, "hostName", s.HostName) - populateTimeRFC3339(objectMap, "lastModified", s.LastModified) - populate(objectMap, "maxCacheAge", s.MaxCacheAge) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "resourceState", s.ResourceState) - populate(objectMap, "scaleUnits", s.ScaleUnits) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StreamingEndpointProperties. -func (s *StreamingEndpointProperties) 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 "accessControl": - err = unpopulate(val, &s.AccessControl) - delete(rawMsg, key) - case "availabilitySetName": - err = unpopulate(val, &s.AvailabilitySetName) - delete(rawMsg, key) - case "cdnEnabled": - err = unpopulate(val, &s.CdnEnabled) - delete(rawMsg, key) - case "cdnProfile": - err = unpopulate(val, &s.CdnProfile) - delete(rawMsg, key) - case "cdnProvider": - err = unpopulate(val, &s.CdnProvider) - delete(rawMsg, key) - case "created": - err = unpopulateTimeRFC3339(val, &s.Created) - delete(rawMsg, key) - case "crossSiteAccessPolicies": - err = unpopulate(val, &s.CrossSiteAccessPolicies) - delete(rawMsg, key) - case "customHostNames": - err = unpopulate(val, &s.CustomHostNames) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &s.Description) - delete(rawMsg, key) - case "freeTrialEndTime": - err = unpopulateTimeRFC3339(val, &s.FreeTrialEndTime) - delete(rawMsg, key) - case "hostName": - err = unpopulate(val, &s.HostName) - delete(rawMsg, key) - case "lastModified": - err = unpopulateTimeRFC3339(val, &s.LastModified) - delete(rawMsg, key) - case "maxCacheAge": - err = unpopulate(val, &s.MaxCacheAge) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &s.ProvisioningState) - delete(rawMsg, key) - case "resourceState": - err = unpopulate(val, &s.ResourceState) - delete(rawMsg, key) - case "scaleUnits": - err = unpopulate(val, &s.ScaleUnits) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - type StreamingEndpointSKUInfoListResult struct { // The result of the List StreamingEndpoint skus. Value []*ArmStreamingEndpointSKUInfo `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type StreamingEndpointSKUInfoListResult. -func (s StreamingEndpointSKUInfoListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - // StreamingEndpointsClientBeginCreateOptions contains the optional parameters for the StreamingEndpointsClient.BeginCreate // method. type StreamingEndpointsClientBeginCreateOptions struct { // The flag indicates if the resource should be automatically started on creation. AutoStart *bool + // Resumes the LRO from the provided token. + ResumeToken string } // StreamingEndpointsClientBeginDeleteOptions contains the optional parameters for the StreamingEndpointsClient.BeginDelete // method. type StreamingEndpointsClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // StreamingEndpointsClientBeginScaleOptions contains the optional parameters for the StreamingEndpointsClient.BeginScale // method. type StreamingEndpointsClientBeginScaleOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // StreamingEndpointsClientBeginStartOptions contains the optional parameters for the StreamingEndpointsClient.BeginStart // method. type StreamingEndpointsClientBeginStartOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // StreamingEndpointsClientBeginStopOptions contains the optional parameters for the StreamingEndpointsClient.BeginStop method. type StreamingEndpointsClientBeginStopOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // StreamingEndpointsClientBeginUpdateOptions contains the optional parameters for the StreamingEndpointsClient.BeginUpdate // method. type StreamingEndpointsClientBeginUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // StreamingEndpointsClientGetOptions contains the optional parameters for the StreamingEndpointsClient.Get method. @@ -7324,14 +3597,6 @@ type StreamingLocatorCollection struct { Value []*StreamingLocator `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type StreamingLocatorCollection. -func (s StreamingLocatorCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@odata.nextLink", s.ODataNextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - // StreamingLocatorContentKey - Class for content key in Streaming Locator type StreamingLocatorContentKey struct { // REQUIRED; ID of Content Key @@ -7353,18 +3618,6 @@ type StreamingLocatorContentKey struct { Type *StreamingLocatorContentKeyType `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type StreamingLocatorContentKey. -func (s StreamingLocatorContentKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "labelReferenceInStreamingPolicy", s.LabelReferenceInStreamingPolicy) - populate(objectMap, "policyName", s.PolicyName) - populate(objectMap, "tracks", s.Tracks) - populate(objectMap, "type", s.Type) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - // StreamingLocatorProperties - Properties of the Streaming Locator. type StreamingLocatorProperties struct { // REQUIRED; Asset Name @@ -7402,69 +3655,6 @@ type StreamingLocatorProperties struct { Created *time.Time `json:"created,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type StreamingLocatorProperties. -func (s StreamingLocatorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alternativeMediaId", s.AlternativeMediaID) - populate(objectMap, "assetName", s.AssetName) - populate(objectMap, "contentKeys", s.ContentKeys) - populateTimeRFC3339(objectMap, "created", s.Created) - populate(objectMap, "defaultContentKeyPolicyName", s.DefaultContentKeyPolicyName) - populateTimeRFC3339(objectMap, "endTime", s.EndTime) - populate(objectMap, "filters", s.Filters) - populateTimeRFC3339(objectMap, "startTime", s.StartTime) - populate(objectMap, "streamingLocatorId", s.StreamingLocatorID) - populate(objectMap, "streamingPolicyName", s.StreamingPolicyName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StreamingLocatorProperties. -func (s *StreamingLocatorProperties) 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 "alternativeMediaId": - err = unpopulate(val, &s.AlternativeMediaID) - delete(rawMsg, key) - case "assetName": - err = unpopulate(val, &s.AssetName) - delete(rawMsg, key) - case "contentKeys": - err = unpopulate(val, &s.ContentKeys) - delete(rawMsg, key) - case "created": - err = unpopulateTimeRFC3339(val, &s.Created) - delete(rawMsg, key) - case "defaultContentKeyPolicyName": - err = unpopulate(val, &s.DefaultContentKeyPolicyName) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, &s.EndTime) - delete(rawMsg, key) - case "filters": - err = unpopulate(val, &s.Filters) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &s.StartTime) - delete(rawMsg, key) - case "streamingLocatorId": - err = unpopulate(val, &s.StreamingLocatorID) - delete(rawMsg, key) - case "streamingPolicyName": - err = unpopulate(val, &s.StreamingPolicyName) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // StreamingLocatorsClientCreateOptions contains the optional parameters for the StreamingLocatorsClient.Create method. type StreamingLocatorsClientCreateOptions struct { // placeholder for future optional parameters @@ -7514,15 +3704,6 @@ type StreamingPath struct { Paths []*string `json:"paths,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type StreamingPath. -func (s StreamingPath) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "encryptionScheme", s.EncryptionScheme) - populate(objectMap, "paths", s.Paths) - populate(objectMap, "streamingProtocol", s.StreamingProtocol) - return json.Marshal(objectMap) -} - // StreamingPoliciesClientCreateOptions contains the optional parameters for the StreamingPoliciesClient.Create method. type StreamingPoliciesClientCreateOptions struct { // placeholder for future optional parameters @@ -7576,14 +3757,6 @@ type StreamingPolicyCollection struct { Value []*StreamingPolicy `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type StreamingPolicyCollection. -func (s StreamingPolicyCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@odata.nextLink", s.ODataNextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - // StreamingPolicyContentKey - Class to specify properties of content key type StreamingPolicyContentKey struct { // Label can be used to specify Content Key when creating a Streaming Locator @@ -7596,15 +3769,6 @@ type StreamingPolicyContentKey struct { Tracks []*TrackSelection `json:"tracks,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type StreamingPolicyContentKey. -func (s StreamingPolicyContentKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "label", s.Label) - populate(objectMap, "policyName", s.PolicyName) - populate(objectMap, "tracks", s.Tracks) - return json.Marshal(objectMap) -} - // StreamingPolicyContentKeys - Class to specify properties of all content keys in Streaming Policy type StreamingPolicyContentKeys struct { // Default content key for an encryption scheme @@ -7614,14 +3778,6 @@ type StreamingPolicyContentKeys struct { KeyToTrackMappings []*StreamingPolicyContentKey `json:"keyToTrackMappings,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type StreamingPolicyContentKeys. -func (s StreamingPolicyContentKeys) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "defaultKey", s.DefaultKey) - populate(objectMap, "keyToTrackMappings", s.KeyToTrackMappings) - return json.Marshal(objectMap) -} - // StreamingPolicyFairPlayConfiguration - Class to specify configurations of FairPlay in Streaming Policy type StreamingPolicyFairPlayConfiguration struct { // REQUIRED; All license to be persistent or not @@ -7671,53 +3827,6 @@ type StreamingPolicyProperties struct { Created *time.Time `json:"created,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type StreamingPolicyProperties. -func (s StreamingPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "commonEncryptionCbcs", s.CommonEncryptionCbcs) - populate(objectMap, "commonEncryptionCenc", s.CommonEncryptionCenc) - populateTimeRFC3339(objectMap, "created", s.Created) - populate(objectMap, "defaultContentKeyPolicyName", s.DefaultContentKeyPolicyName) - populate(objectMap, "envelopeEncryption", s.EnvelopeEncryption) - populate(objectMap, "noEncryption", s.NoEncryption) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StreamingPolicyProperties. -func (s *StreamingPolicyProperties) 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 "commonEncryptionCbcs": - err = unpopulate(val, &s.CommonEncryptionCbcs) - delete(rawMsg, key) - case "commonEncryptionCenc": - err = unpopulate(val, &s.CommonEncryptionCenc) - delete(rawMsg, key) - case "created": - err = unpopulateTimeRFC3339(val, &s.Created) - delete(rawMsg, key) - case "defaultContentKeyPolicyName": - err = unpopulate(val, &s.DefaultContentKeyPolicyName) - delete(rawMsg, key) - case "envelopeEncryption": - err = unpopulate(val, &s.EnvelopeEncryption) - delete(rawMsg, key) - case "noEncryption": - err = unpopulate(val, &s.NoEncryption) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // StreamingPolicyWidevineConfiguration - Class to specify configurations of Widevine in Streaming Policy type StreamingPolicyWidevineConfiguration struct { // Template for the URL of the custom service delivering licenses to end user players. Not required when using Azure Media @@ -7756,53 +3865,6 @@ type SystemData struct { 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 -} - // TextTrack - Represents a text track in an asset. A text track is usually used for sparse data related to the audio or video // tracks. type TextTrack struct { @@ -7827,60 +3889,6 @@ type TextTrack struct { LanguageCode *string `json:"languageCode,omitempty" azure:"ro"` } -// GetTrackBase implements the TrackBaseClassification interface for type TextTrack. -func (t *TextTrack) GetTrackBase() *TrackBase { - return &TrackBase{ - ODataType: t.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type TextTrack. -func (t TextTrack) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", t.DisplayName) - populate(objectMap, "fileName", t.FileName) - populate(objectMap, "hlsSettings", t.HlsSettings) - populate(objectMap, "languageCode", t.LanguageCode) - objectMap["@odata.type"] = "#Microsoft.Media.TextTrack" - populate(objectMap, "playerVisibility", t.PlayerVisibility) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TextTrack. -func (t *TextTrack) 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 "displayName": - err = unpopulate(val, &t.DisplayName) - delete(rawMsg, key) - case "fileName": - err = unpopulate(val, &t.FileName) - delete(rawMsg, key) - case "hlsSettings": - err = unpopulate(val, &t.HlsSettings) - delete(rawMsg, key) - case "languageCode": - err = unpopulate(val, &t.LanguageCode) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &t.ODataType) - delete(rawMsg, key) - case "playerVisibility": - err = unpopulate(val, &t.PlayerVisibility) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // TrackBaseClassification provides polymorphic access to related types. // Call the interface's GetTrackBase() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -7896,9 +3904,6 @@ type TrackBase struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetTrackBase implements the TrackBaseClassification interface for type TrackBase. -func (t *TrackBase) GetTrackBase() *TrackBase { return t } - // TrackDescriptorClassification provides polymorphic access to related types. // Call the interface's GetTrackDescriptor() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -7916,9 +3921,6 @@ type TrackDescriptor struct { ODataType *string `json:"@odata.type,omitempty"` } -// GetTrackDescriptor implements the TrackDescriptorClassification interface for type TrackDescriptor. -func (t *TrackDescriptor) GetTrackDescriptor() *TrackDescriptor { return t } - // TrackPropertyCondition - Class to specify one track property condition type TrackPropertyCondition struct { // REQUIRED; Track property condition operation @@ -7937,13 +3939,6 @@ type TrackSelection struct { TrackSelections []*TrackPropertyCondition `json:"trackSelections,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type TrackSelection. -func (t TrackSelection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "trackSelections", t.TrackSelections) - return json.Marshal(objectMap) -} - // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { @@ -7963,35 +3958,28 @@ type TrackedResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - // TracksClientBeginCreateOrUpdateOptions contains the optional parameters for the TracksClient.BeginCreateOrUpdate method. type TracksClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // TracksClientBeginDeleteOptions contains the optional parameters for the TracksClient.BeginDelete method. type TracksClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // TracksClientBeginUpdateOptions contains the optional parameters for the TracksClient.BeginUpdate method. type TracksClientBeginUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // TracksClientBeginUpdateTrackDataOptions contains the optional parameters for the TracksClient.BeginUpdateTrackData method. type TracksClientBeginUpdateTrackDataOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // TracksClientGetOptions contains the optional parameters for the TracksClient.Get method. @@ -8024,17 +4012,6 @@ type Transform struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Transform. -func (t Transform) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - // TransformCollection - A collection of Transform items. type TransformCollection struct { // A link to the next page of the collection (when the collection contains too many results to return in one response). @@ -8044,14 +4021,6 @@ type TransformCollection struct { Value []*Transform `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type TransformCollection. -func (t TransformCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@odata.nextLink", t.ODataNextLink) - populate(objectMap, "value", t.Value) - return json.Marshal(objectMap) -} - // TransformOutput - Describes the properties of a TransformOutput, which are the rules to be applied while generating the // desired output. type TransformOutput struct { @@ -8069,41 +4038,6 @@ type TransformOutput struct { RelativePriority *Priority `json:"relativePriority,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type TransformOutput. -func (t TransformOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "onError", t.OnError) - populate(objectMap, "preset", t.Preset) - populate(objectMap, "relativePriority", t.RelativePriority) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TransformOutput. -func (t *TransformOutput) 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 "onError": - err = unpopulate(val, &t.OnError) - delete(rawMsg, key) - case "preset": - t.Preset, err = unmarshalPresetClassification(val) - delete(rawMsg, key) - case "relativePriority": - err = unpopulate(val, &t.RelativePriority) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // TransformProperties - A Transform. type TransformProperties struct { // REQUIRED; An array of one or more TransformOutputs that the Transform should generate. @@ -8119,45 +4053,6 @@ type TransformProperties struct { LastModified *time.Time `json:"lastModified,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type TransformProperties. -func (t TransformProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "created", t.Created) - populate(objectMap, "description", t.Description) - populateTimeRFC3339(objectMap, "lastModified", t.LastModified) - populate(objectMap, "outputs", t.Outputs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TransformProperties. -func (t *TransformProperties) 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 "created": - err = unpopulateTimeRFC3339(val, &t.Created) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &t.Description) - delete(rawMsg, key) - case "lastModified": - err = unpopulateTimeRFC3339(val, &t.LastModified) - delete(rawMsg, key) - case "outputs": - err = unpopulate(val, &t.Outputs) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // TransformsClientCreateOrUpdateOptions contains the optional parameters for the TransformsClient.CreateOrUpdate method. type TransformsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -8208,58 +4103,6 @@ type TransportStreamFormat struct { OutputFiles []*OutputFile `json:"outputFiles,omitempty"` } -// GetFormat implements the FormatClassification interface for type TransportStreamFormat. -func (t *TransportStreamFormat) GetFormat() *Format { - return &Format{ - ODataType: t.ODataType, - FilenamePattern: t.FilenamePattern, - } -} - -// GetMultiBitrateFormat implements the MultiBitrateFormatClassification interface for type TransportStreamFormat. -func (t *TransportStreamFormat) GetMultiBitrateFormat() *MultiBitrateFormat { - return &MultiBitrateFormat{ - OutputFiles: t.OutputFiles, - ODataType: t.ODataType, - FilenamePattern: t.FilenamePattern, - } -} - -// MarshalJSON implements the json.Marshaller interface for type TransportStreamFormat. -func (t TransportStreamFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filenamePattern", t.FilenamePattern) - objectMap["@odata.type"] = "#Microsoft.Media.TransportStreamFormat" - populate(objectMap, "outputFiles", t.OutputFiles) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TransportStreamFormat. -func (t *TransportStreamFormat) 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 "filenamePattern": - err = unpopulate(val, &t.FilenamePattern) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &t.ODataType) - delete(rawMsg, key) - case "outputFiles": - err = unpopulate(val, &t.OutputFiles) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // UTCClipTime - Specifies the clip time as a Utc time position in the media file. The Utc time can point to a different position // depending on whether the media file starts from a timestamp of zero or not. type UTCClipTime struct { @@ -8270,44 +4113,6 @@ type UTCClipTime struct { Time *time.Time `json:"time,omitempty"` } -// GetClipTime implements the ClipTimeClassification interface for type UTCClipTime. -func (u *UTCClipTime) GetClipTime() *ClipTime { - return &ClipTime{ - ODataType: u.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type UTCClipTime. -func (u UTCClipTime) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["@odata.type"] = "#Microsoft.Media.UtcClipTime" - populateTimeRFC3339(objectMap, "time", u.Time) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UTCClipTime. -func (u *UTCClipTime) 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 "@odata.type": - err = unpopulate(val, &u.ODataType) - delete(rawMsg, key) - case "time": - err = unpopulateTimeRFC3339(val, &u.Time) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - type UserAssignedManagedIdentity struct { // READ-ONLY; The client ID. ClientID *string `json:"clientId,omitempty" azure:"ro"` @@ -8346,60 +4151,6 @@ type Video struct { SyncMode *VideoSyncMode `json:"syncMode,omitempty"` } -// GetCodec implements the CodecClassification interface for type Video. -func (v *Video) GetCodec() *Codec { - return &Codec{ - ODataType: v.ODataType, - Label: v.Label, - } -} - -// GetVideo implements the VideoClassification interface for type Video. -func (v *Video) GetVideo() *Video { return v } - -// MarshalJSON implements the json.Marshaller interface for type Video. -func (v Video) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "keyFrameInterval", v.KeyFrameInterval) - populate(objectMap, "label", v.Label) - objectMap["@odata.type"] = "#Microsoft.Media.Video" - populate(objectMap, "stretchMode", v.StretchMode) - populate(objectMap, "syncMode", v.SyncMode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Video. -func (v *Video) 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 "keyFrameInterval": - err = unpopulate(val, &v.KeyFrameInterval) - delete(rawMsg, key) - case "label": - err = unpopulate(val, &v.Label) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &v.ODataType) - delete(rawMsg, key) - case "stretchMode": - err = unpopulate(val, &v.StretchMode) - delete(rawMsg, key) - case "syncMode": - err = unpopulate(val, &v.SyncMode) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // VideoAnalyzerPreset - A video analyzer preset that extracts insights (rich metadata) from both audio and video, and outputs // a JSON format file. type VideoAnalyzerPreset struct { @@ -8433,66 +4184,6 @@ type VideoAnalyzerPreset struct { Mode *AudioAnalysisMode `json:"mode,omitempty"` } -// GetAudioAnalyzerPreset implements the AudioAnalyzerPresetClassification interface for type VideoAnalyzerPreset. -func (v *VideoAnalyzerPreset) GetAudioAnalyzerPreset() *AudioAnalyzerPreset { - return &AudioAnalyzerPreset{ - AudioLanguage: v.AudioLanguage, - Mode: v.Mode, - ExperimentalOptions: v.ExperimentalOptions, - ODataType: v.ODataType, - } -} - -// GetPreset implements the PresetClassification interface for type VideoAnalyzerPreset. -func (v *VideoAnalyzerPreset) GetPreset() *Preset { - return &Preset{ - ODataType: v.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type VideoAnalyzerPreset. -func (v VideoAnalyzerPreset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "audioLanguage", v.AudioLanguage) - populate(objectMap, "experimentalOptions", v.ExperimentalOptions) - populate(objectMap, "insightsToExtract", v.InsightsToExtract) - populate(objectMap, "mode", v.Mode) - objectMap["@odata.type"] = "#Microsoft.Media.VideoAnalyzerPreset" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VideoAnalyzerPreset. -func (v *VideoAnalyzerPreset) 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 "audioLanguage": - err = unpopulate(val, &v.AudioLanguage) - delete(rawMsg, key) - case "experimentalOptions": - err = unpopulate(val, &v.ExperimentalOptions) - delete(rawMsg, key) - case "insightsToExtract": - err = unpopulate(val, &v.InsightsToExtract) - delete(rawMsg, key) - case "mode": - err = unpopulate(val, &v.Mode) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &v.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // VideoLayer - Describes the settings to be used when encoding the input video into a desired output bitrate layer. type VideoLayer struct { // REQUIRED; The average bitrate in bits per second at which to encode the input video when generating this layer. This is @@ -8578,122 +4269,12 @@ type VideoOverlay struct { Start *string `json:"start,omitempty"` } -// GetOverlay implements the OverlayClassification interface for type VideoOverlay. -func (v *VideoOverlay) GetOverlay() *Overlay { - return &Overlay{ - ODataType: v.ODataType, - InputLabel: v.InputLabel, - Start: v.Start, - End: v.End, - FadeInDuration: v.FadeInDuration, - FadeOutDuration: v.FadeOutDuration, - AudioGainLevel: v.AudioGainLevel, - } -} - -// MarshalJSON implements the json.Marshaller interface for type VideoOverlay. -func (v VideoOverlay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "audioGainLevel", v.AudioGainLevel) - populate(objectMap, "cropRectangle", v.CropRectangle) - populate(objectMap, "end", v.End) - populate(objectMap, "fadeInDuration", v.FadeInDuration) - populate(objectMap, "fadeOutDuration", v.FadeOutDuration) - populate(objectMap, "inputLabel", v.InputLabel) - objectMap["@odata.type"] = "#Microsoft.Media.VideoOverlay" - populate(objectMap, "opacity", v.Opacity) - populate(objectMap, "position", v.Position) - populate(objectMap, "start", v.Start) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VideoOverlay. -func (v *VideoOverlay) 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 "audioGainLevel": - err = unpopulate(val, &v.AudioGainLevel) - delete(rawMsg, key) - case "cropRectangle": - err = unpopulate(val, &v.CropRectangle) - delete(rawMsg, key) - case "end": - err = unpopulate(val, &v.End) - delete(rawMsg, key) - case "fadeInDuration": - err = unpopulate(val, &v.FadeInDuration) - delete(rawMsg, key) - case "fadeOutDuration": - err = unpopulate(val, &v.FadeOutDuration) - delete(rawMsg, key) - case "inputLabel": - err = unpopulate(val, &v.InputLabel) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, &v.ODataType) - delete(rawMsg, key) - case "opacity": - err = unpopulate(val, &v.Opacity) - delete(rawMsg, key) - case "position": - err = unpopulate(val, &v.Position) - delete(rawMsg, key) - case "start": - err = unpopulate(val, &v.Start) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // VideoTrack - Represents a video track in the asset. type VideoTrack struct { // REQUIRED; The discriminator for derived types. ODataType *string `json:"@odata.type,omitempty"` } -// GetTrackBase implements the TrackBaseClassification interface for type VideoTrack. -func (v *VideoTrack) GetTrackBase() *TrackBase { - return &TrackBase{ - ODataType: v.ODataType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type VideoTrack. -func (v VideoTrack) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["@odata.type"] = "#Microsoft.Media.VideoTrack" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VideoTrack. -func (v *VideoTrack) 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 "@odata.type": - err = unpopulate(val, &v.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // VideoTrackDescriptorClassification provides polymorphic access to related types. // Call the interface's GetVideoTrackDescriptor() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -8709,67 +4290,3 @@ type VideoTrackDescriptor struct { // REQUIRED; The discriminator for derived types. ODataType *string `json:"@odata.type,omitempty"` } - -// GetTrackDescriptor implements the TrackDescriptorClassification interface for type VideoTrackDescriptor. -func (v *VideoTrackDescriptor) GetTrackDescriptor() *TrackDescriptor { - return &TrackDescriptor{ - ODataType: v.ODataType, - } -} - -// GetVideoTrackDescriptor implements the VideoTrackDescriptorClassification interface for type VideoTrackDescriptor. -func (v *VideoTrackDescriptor) GetVideoTrackDescriptor() *VideoTrackDescriptor { return v } - -// MarshalJSON implements the json.Marshaller interface for type VideoTrackDescriptor. -func (v VideoTrackDescriptor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["@odata.type"] = "#Microsoft.Media.VideoTrackDescriptor" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VideoTrackDescriptor. -func (v *VideoTrackDescriptor) 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 "@odata.type": - err = unpopulate(val, &v.ODataType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -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 - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models_serde.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models_serde.go new file mode 100644 index 000000000000..baf8cd6394c8 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models_serde.go @@ -0,0 +1,4521 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armmediaservices + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" +) + +// GetAudio implements the AudioClassification interface for type AacAudio. +func (a *AacAudio) GetAudio() *Audio { + return &Audio{ + Channels: a.Channels, + SamplingRate: a.SamplingRate, + Bitrate: a.Bitrate, + ODataType: a.ODataType, + Label: a.Label, + } +} + +// GetCodec implements the CodecClassification interface for type AacAudio. +func (a *AacAudio) GetCodec() *Codec { + return &Codec{ + ODataType: a.ODataType, + Label: a.Label, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AacAudio. +func (a AacAudio) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bitrate", a.Bitrate) + populate(objectMap, "channels", a.Channels) + populate(objectMap, "label", a.Label) + objectMap["@odata.type"] = "#Microsoft.Media.AacAudio" + populate(objectMap, "profile", a.Profile) + populate(objectMap, "samplingRate", a.SamplingRate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AacAudio. +func (a *AacAudio) 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 "bitrate": + err = unpopulate(val, &a.Bitrate) + delete(rawMsg, key) + case "channels": + err = unpopulate(val, &a.Channels) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &a.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &a.ODataType) + delete(rawMsg, key) + case "profile": + err = unpopulate(val, &a.Profile) + delete(rawMsg, key) + case "samplingRate": + err = unpopulate(val, &a.SamplingRate) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetClipTime implements the ClipTimeClassification interface for type AbsoluteClipTime. +func (a *AbsoluteClipTime) GetClipTime() *ClipTime { + return &ClipTime{ + ODataType: a.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AbsoluteClipTime. +func (a AbsoluteClipTime) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = "#Microsoft.Media.AbsoluteClipTime" + populate(objectMap, "time", a.Time) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AbsoluteClipTime. +func (a *AbsoluteClipTime) 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 "@odata.type": + err = unpopulate(val, &a.ODataType) + delete(rawMsg, key) + case "time": + err = unpopulate(val, &a.Time) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccessControl. +func (a AccessControl) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultAction", a.DefaultAction) + populate(objectMap, "ipAllowList", a.IPAllowList) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AccountFilter. +func (a AccountFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AccountFilterCollection. +func (a AccountFilterCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", a.ODataNextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AkamaiAccessControl. +func (a AkamaiAccessControl) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "akamaiSignatureHeaderAuthenticationKeyList", a.AkamaiSignatureHeaderAuthenticationKeyList) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AkamaiSignatureHeaderAuthenticationKey. +func (a AkamaiSignatureHeaderAuthenticationKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "base64Key", a.Base64Key) + populateTimeRFC3339(objectMap, "expiration", a.Expiration) + populate(objectMap, "identifier", a.Identifier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AkamaiSignatureHeaderAuthenticationKey. +func (a *AkamaiSignatureHeaderAuthenticationKey) 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 "base64Key": + err = unpopulate(val, &a.Base64Key) + delete(rawMsg, key) + case "expiration": + err = unpopulateTimeRFC3339(val, &a.Expiration) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, &a.Identifier) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Asset. +func (a Asset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AssetCollection. +func (a AssetCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", a.ODataNextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AssetContainerSas. +func (a AssetContainerSas) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assetContainerSasUrls", a.AssetContainerSasUrls) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AssetFilter. +func (a AssetFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AssetFilterCollection. +func (a AssetFilterCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", a.ODataNextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AssetProperties. +func (a AssetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alternateId", a.AlternateID) + populate(objectMap, "assetId", a.AssetID) + populate(objectMap, "container", a.Container) + populateTimeRFC3339(objectMap, "created", a.Created) + populate(objectMap, "description", a.Description) + populateTimeRFC3339(objectMap, "lastModified", a.LastModified) + populate(objectMap, "storageAccountName", a.StorageAccountName) + populate(objectMap, "storageEncryptionFormat", a.StorageEncryptionFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssetProperties. +func (a *AssetProperties) 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 "alternateId": + err = unpopulate(val, &a.AlternateID) + delete(rawMsg, key) + case "assetId": + err = unpopulate(val, &a.AssetID) + delete(rawMsg, key) + case "container": + err = unpopulate(val, &a.Container) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC3339(val, &a.Created) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &a.Description) + delete(rawMsg, key) + case "lastModified": + err = unpopulateTimeRFC3339(val, &a.LastModified) + delete(rawMsg, key) + case "storageAccountName": + err = unpopulate(val, &a.StorageAccountName) + delete(rawMsg, key) + case "storageEncryptionFormat": + err = unpopulate(val, &a.StorageEncryptionFormat) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AssetStreamingLocator. +func (a AssetStreamingLocator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assetName", a.AssetName) + populateTimeRFC3339(objectMap, "created", a.Created) + populate(objectMap, "defaultContentKeyPolicyName", a.DefaultContentKeyPolicyName) + populateTimeRFC3339(objectMap, "endTime", a.EndTime) + populate(objectMap, "name", a.Name) + populateTimeRFC3339(objectMap, "startTime", a.StartTime) + populate(objectMap, "streamingLocatorId", a.StreamingLocatorID) + populate(objectMap, "streamingPolicyName", a.StreamingPolicyName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssetStreamingLocator. +func (a *AssetStreamingLocator) 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 "assetName": + err = unpopulate(val, &a.AssetName) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC3339(val, &a.Created) + delete(rawMsg, key) + case "defaultContentKeyPolicyName": + err = unpopulate(val, &a.DefaultContentKeyPolicyName) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, &a.EndTime) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &a.Name) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &a.StartTime) + delete(rawMsg, key) + case "streamingLocatorId": + err = unpopulate(val, &a.StreamingLocatorID) + delete(rawMsg, key) + case "streamingPolicyName": + err = unpopulate(val, &a.StreamingPolicyName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AssetTrack. +func (a AssetTrack) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AssetTrackCollection. +func (a AssetTrackCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AssetTrackOperationStatus. +func (a AssetTrackOperationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", a.EndTime) + populate(objectMap, "error", a.Error) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populateTimeRFC3339(objectMap, "startTime", a.StartTime) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssetTrackOperationStatus. +func (a *AssetTrackOperationStatus) 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 "endTime": + err = unpopulateTimeRFC3339(val, &a.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, &a.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &a.Name) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &a.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, &a.Status) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AssetTrackProperties. +func (a AssetTrackProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "track", a.Track) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssetTrackProperties. +func (a *AssetTrackProperties) 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 "provisioningState": + err = unpopulate(val, &a.ProvisioningState) + delete(rawMsg, key) + case "track": + a.Track, err = unmarshalTrackBaseClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetAudio implements the AudioClassification interface for type Audio. +func (a *Audio) GetAudio() *Audio { return a } + +// GetCodec implements the CodecClassification interface for type Audio. +func (a *Audio) GetCodec() *Codec { + return &Codec{ + ODataType: a.ODataType, + Label: a.Label, + } +} + +// MarshalJSON implements the json.Marshaller interface for type Audio. +func (a Audio) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bitrate", a.Bitrate) + populate(objectMap, "channels", a.Channels) + populate(objectMap, "label", a.Label) + objectMap["@odata.type"] = "#Microsoft.Media.Audio" + populate(objectMap, "samplingRate", a.SamplingRate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Audio. +func (a *Audio) 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 "bitrate": + err = unpopulate(val, &a.Bitrate) + delete(rawMsg, key) + case "channels": + err = unpopulate(val, &a.Channels) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &a.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &a.ODataType) + delete(rawMsg, key) + case "samplingRate": + err = unpopulate(val, &a.SamplingRate) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetAudioAnalyzerPreset implements the AudioAnalyzerPresetClassification interface for type AudioAnalyzerPreset. +func (a *AudioAnalyzerPreset) GetAudioAnalyzerPreset() *AudioAnalyzerPreset { return a } + +// GetPreset implements the PresetClassification interface for type AudioAnalyzerPreset. +func (a *AudioAnalyzerPreset) GetPreset() *Preset { + return &Preset{ + ODataType: a.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AudioAnalyzerPreset. +func (a AudioAnalyzerPreset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "audioLanguage", a.AudioLanguage) + populate(objectMap, "experimentalOptions", a.ExperimentalOptions) + populate(objectMap, "mode", a.Mode) + objectMap["@odata.type"] = "#Microsoft.Media.AudioAnalyzerPreset" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AudioAnalyzerPreset. +func (a *AudioAnalyzerPreset) 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 "audioLanguage": + err = unpopulate(val, &a.AudioLanguage) + delete(rawMsg, key) + case "experimentalOptions": + err = unpopulate(val, &a.ExperimentalOptions) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, &a.Mode) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &a.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetOverlay implements the OverlayClassification interface for type AudioOverlay. +func (a *AudioOverlay) GetOverlay() *Overlay { + return &Overlay{ + ODataType: a.ODataType, + InputLabel: a.InputLabel, + Start: a.Start, + End: a.End, + FadeInDuration: a.FadeInDuration, + FadeOutDuration: a.FadeOutDuration, + AudioGainLevel: a.AudioGainLevel, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AudioOverlay. +func (a AudioOverlay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "audioGainLevel", a.AudioGainLevel) + populate(objectMap, "end", a.End) + populate(objectMap, "fadeInDuration", a.FadeInDuration) + populate(objectMap, "fadeOutDuration", a.FadeOutDuration) + populate(objectMap, "inputLabel", a.InputLabel) + objectMap["@odata.type"] = "#Microsoft.Media.AudioOverlay" + populate(objectMap, "start", a.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AudioOverlay. +func (a *AudioOverlay) 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 "audioGainLevel": + err = unpopulate(val, &a.AudioGainLevel) + delete(rawMsg, key) + case "end": + err = unpopulate(val, &a.End) + delete(rawMsg, key) + case "fadeInDuration": + err = unpopulate(val, &a.FadeInDuration) + delete(rawMsg, key) + case "fadeOutDuration": + err = unpopulate(val, &a.FadeOutDuration) + delete(rawMsg, key) + case "inputLabel": + err = unpopulate(val, &a.InputLabel) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &a.ODataType) + delete(rawMsg, key) + case "start": + err = unpopulate(val, &a.Start) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetTrackBase implements the TrackBaseClassification interface for type AudioTrack. +func (a *AudioTrack) GetTrackBase() *TrackBase { + return &TrackBase{ + ODataType: a.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AudioTrack. +func (a AudioTrack) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = "#Microsoft.Media.AudioTrack" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AudioTrack. +func (a *AudioTrack) 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 "@odata.type": + err = unpopulate(val, &a.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetAudioTrackDescriptor implements the AudioTrackDescriptorClassification interface for type AudioTrackDescriptor. +func (a *AudioTrackDescriptor) GetAudioTrackDescriptor() *AudioTrackDescriptor { return a } + +// GetTrackDescriptor implements the TrackDescriptorClassification interface for type AudioTrackDescriptor. +func (a *AudioTrackDescriptor) GetTrackDescriptor() *TrackDescriptor { + return &TrackDescriptor{ + ODataType: a.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AudioTrackDescriptor. +func (a AudioTrackDescriptor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "channelMapping", a.ChannelMapping) + objectMap["@odata.type"] = "#Microsoft.Media.AudioTrackDescriptor" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AudioTrackDescriptor. +func (a *AudioTrackDescriptor) 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 "channelMapping": + err = unpopulate(val, &a.ChannelMapping) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &a.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetPreset implements the PresetClassification interface for type BuiltInStandardEncoderPreset. +func (b *BuiltInStandardEncoderPreset) GetPreset() *Preset { + return &Preset{ + ODataType: b.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type BuiltInStandardEncoderPreset. +func (b BuiltInStandardEncoderPreset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configurations", b.Configurations) + objectMap["@odata.type"] = "#Microsoft.Media.BuiltInStandardEncoderPreset" + populate(objectMap, "presetName", b.PresetName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BuiltInStandardEncoderPreset. +func (b *BuiltInStandardEncoderPreset) 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 "configurations": + err = unpopulate(val, &b.Configurations) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &b.ODataType) + delete(rawMsg, key) + case "presetName": + err = unpopulate(val, &b.PresetName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetClipTime implements the ClipTimeClassification interface for type ClipTime. +func (c *ClipTime) GetClipTime() *ClipTime { return c } + +// GetCodec implements the CodecClassification interface for type Codec. +func (c *Codec) GetCodec() *Codec { return c } + +// MarshalJSON implements the json.Marshaller interface for type CommonEncryptionCbcs. +func (c CommonEncryptionCbcs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clearTracks", c.ClearTracks) + populate(objectMap, "contentKeys", c.ContentKeys) + populate(objectMap, "drm", c.Drm) + populate(objectMap, "enabledProtocols", c.EnabledProtocols) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CommonEncryptionCenc. +func (c CommonEncryptionCenc) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clearTracks", c.ClearTracks) + populate(objectMap, "contentKeys", c.ContentKeys) + populate(objectMap, "drm", c.Drm) + populate(objectMap, "enabledProtocols", c.EnabledProtocols) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicy. +func (c ContentKeyPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// GetContentKeyPolicyConfiguration implements the ContentKeyPolicyConfigurationClassification interface for type ContentKeyPolicyClearKeyConfiguration. +func (c *ContentKeyPolicyClearKeyConfiguration) GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration { + return &ContentKeyPolicyConfiguration{ + ODataType: c.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyClearKeyConfiguration. +func (c ContentKeyPolicyClearKeyConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyClearKeyConfiguration. +func (c *ContentKeyPolicyClearKeyConfiguration) 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 "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyCollection. +func (c ContentKeyPolicyCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", c.ODataNextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// GetContentKeyPolicyConfiguration implements the ContentKeyPolicyConfigurationClassification interface for type ContentKeyPolicyConfiguration. +func (c *ContentKeyPolicyConfiguration) GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration { + return c +} + +// GetContentKeyPolicyConfiguration implements the ContentKeyPolicyConfigurationClassification interface for type ContentKeyPolicyFairPlayConfiguration. +func (c *ContentKeyPolicyFairPlayConfiguration) GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration { + return &ContentKeyPolicyConfiguration{ + ODataType: c.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyFairPlayConfiguration. +func (c ContentKeyPolicyFairPlayConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateByteArray(objectMap, "ask", c.Ask, runtime.Base64StdFormat) + populate(objectMap, "fairPlayPfx", c.FairPlayPfx) + populate(objectMap, "fairPlayPfxPassword", c.FairPlayPfxPassword) + objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration" + populate(objectMap, "offlineRentalConfiguration", c.OfflineRentalConfiguration) + populate(objectMap, "rentalAndLeaseKeyType", c.RentalAndLeaseKeyType) + populate(objectMap, "rentalDuration", c.RentalDuration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyFairPlayConfiguration. +func (c *ContentKeyPolicyFairPlayConfiguration) 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 "ask": + err = runtime.DecodeByteArray(string(val), &c.Ask, runtime.Base64StdFormat) + delete(rawMsg, key) + case "fairPlayPfx": + err = unpopulate(val, &c.FairPlayPfx) + delete(rawMsg, key) + case "fairPlayPfxPassword": + err = unpopulate(val, &c.FairPlayPfxPassword) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + case "offlineRentalConfiguration": + err = unpopulate(val, &c.OfflineRentalConfiguration) + delete(rawMsg, key) + case "rentalAndLeaseKeyType": + err = unpopulate(val, &c.RentalAndLeaseKeyType) + delete(rawMsg, key) + case "rentalDuration": + err = unpopulate(val, &c.RentalDuration) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetContentKeyPolicyRestriction implements the ContentKeyPolicyRestrictionClassification interface for type ContentKeyPolicyOpenRestriction. +func (c *ContentKeyPolicyOpenRestriction) GetContentKeyPolicyRestriction() *ContentKeyPolicyRestriction { + return &ContentKeyPolicyRestriction{ + ODataType: c.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyOpenRestriction. +func (c ContentKeyPolicyOpenRestriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyOpenRestriction" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyOpenRestriction. +func (c *ContentKeyPolicyOpenRestriction) 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 "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyOption. +func (c ContentKeyPolicyOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configuration", c.Configuration) + populate(objectMap, "name", c.Name) + populate(objectMap, "policyOptionId", c.PolicyOptionID) + populate(objectMap, "restriction", c.Restriction) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyOption. +func (c *ContentKeyPolicyOption) 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 "configuration": + c.Configuration, err = unmarshalContentKeyPolicyConfigurationClassification(val) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &c.Name) + delete(rawMsg, key) + case "policyOptionId": + err = unpopulate(val, &c.PolicyOptionID) + delete(rawMsg, key) + case "restriction": + c.Restriction, err = unmarshalContentKeyPolicyRestrictionClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetContentKeyPolicyConfiguration implements the ContentKeyPolicyConfigurationClassification interface for type ContentKeyPolicyPlayReadyConfiguration. +func (c *ContentKeyPolicyPlayReadyConfiguration) GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration { + return &ContentKeyPolicyConfiguration{ + ODataType: c.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyPlayReadyConfiguration. +func (c ContentKeyPolicyPlayReadyConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "licenses", c.Licenses) + objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration" + populate(objectMap, "responseCustomData", c.ResponseCustomData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyPlayReadyConfiguration. +func (c *ContentKeyPolicyPlayReadyConfiguration) 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 "licenses": + err = unpopulate(val, &c.Licenses) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + case "responseCustomData": + err = unpopulate(val, &c.ResponseCustomData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetContentKeyPolicyPlayReadyContentKeyLocation implements the ContentKeyPolicyPlayReadyContentKeyLocationClassification +// interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader. +func (c *ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) GetContentKeyPolicyPlayReadyContentKeyLocation() *ContentKeyPolicyPlayReadyContentKeyLocation { + return &ContentKeyPolicyPlayReadyContentKeyLocation{ + ODataType: c.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader. +func (c ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader. +func (c *ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) 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 "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetContentKeyPolicyPlayReadyContentKeyLocation implements the ContentKeyPolicyPlayReadyContentKeyLocationClassification +// interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. +func (c *ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) GetContentKeyPolicyPlayReadyContentKeyLocation() *ContentKeyPolicyPlayReadyContentKeyLocation { + return &ContentKeyPolicyPlayReadyContentKeyLocation{ + ODataType: c.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. +func (c ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyId", c.KeyID) + objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. +func (c *ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) 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 "keyId": + err = unpopulate(val, &c.KeyID) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetContentKeyPolicyPlayReadyContentKeyLocation implements the ContentKeyPolicyPlayReadyContentKeyLocationClassification +// interface for type ContentKeyPolicyPlayReadyContentKeyLocation. +func (c *ContentKeyPolicyPlayReadyContentKeyLocation) GetContentKeyPolicyPlayReadyContentKeyLocation() *ContentKeyPolicyPlayReadyContentKeyLocation { + return c +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyPlayReadyLicense. +func (c ContentKeyPolicyPlayReadyLicense) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowTestDevices", c.AllowTestDevices) + populateTimeRFC3339(objectMap, "beginDate", c.BeginDate) + populate(objectMap, "contentKeyLocation", c.ContentKeyLocation) + populate(objectMap, "contentType", c.ContentType) + populateTimeRFC3339(objectMap, "expirationDate", c.ExpirationDate) + populate(objectMap, "gracePeriod", c.GracePeriod) + populate(objectMap, "licenseType", c.LicenseType) + populate(objectMap, "playRight", c.PlayRight) + populate(objectMap, "relativeBeginDate", c.RelativeBeginDate) + populate(objectMap, "relativeExpirationDate", c.RelativeExpirationDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyPlayReadyLicense. +func (c *ContentKeyPolicyPlayReadyLicense) 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 "allowTestDevices": + err = unpopulate(val, &c.AllowTestDevices) + delete(rawMsg, key) + case "beginDate": + err = unpopulateTimeRFC3339(val, &c.BeginDate) + delete(rawMsg, key) + case "contentKeyLocation": + c.ContentKeyLocation, err = unmarshalContentKeyPolicyPlayReadyContentKeyLocationClassification(val) + delete(rawMsg, key) + case "contentType": + err = unpopulate(val, &c.ContentType) + delete(rawMsg, key) + case "expirationDate": + err = unpopulateTimeRFC3339(val, &c.ExpirationDate) + delete(rawMsg, key) + case "gracePeriod": + err = unpopulate(val, &c.GracePeriod) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, &c.LicenseType) + delete(rawMsg, key) + case "playRight": + err = unpopulate(val, &c.PlayRight) + delete(rawMsg, key) + case "relativeBeginDate": + err = unpopulate(val, &c.RelativeBeginDate) + delete(rawMsg, key) + case "relativeExpirationDate": + err = unpopulate(val, &c.RelativeExpirationDate) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyProperties. +func (c ContentKeyPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "created", c.Created) + populate(objectMap, "description", c.Description) + populateTimeRFC3339(objectMap, "lastModified", c.LastModified) + populate(objectMap, "options", c.Options) + populate(objectMap, "policyId", c.PolicyID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyProperties. +func (c *ContentKeyPolicyProperties) 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 "created": + err = unpopulateTimeRFC3339(val, &c.Created) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &c.Description) + delete(rawMsg, key) + case "lastModified": + err = unpopulateTimeRFC3339(val, &c.LastModified) + delete(rawMsg, key) + case "options": + err = unpopulate(val, &c.Options) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, &c.PolicyID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetContentKeyPolicyRestriction implements the ContentKeyPolicyRestrictionClassification interface for type ContentKeyPolicyRestriction. +func (c *ContentKeyPolicyRestriction) GetContentKeyPolicyRestriction() *ContentKeyPolicyRestriction { + return c +} + +// GetContentKeyPolicyRestrictionTokenKey implements the ContentKeyPolicyRestrictionTokenKeyClassification interface for type +// ContentKeyPolicyRestrictionTokenKey. +func (c *ContentKeyPolicyRestrictionTokenKey) GetContentKeyPolicyRestrictionTokenKey() *ContentKeyPolicyRestrictionTokenKey { + return c +} + +// GetContentKeyPolicyRestrictionTokenKey implements the ContentKeyPolicyRestrictionTokenKeyClassification interface for type +// ContentKeyPolicyRsaTokenKey. +func (c *ContentKeyPolicyRsaTokenKey) GetContentKeyPolicyRestrictionTokenKey() *ContentKeyPolicyRestrictionTokenKey { + return &ContentKeyPolicyRestrictionTokenKey{ + ODataType: c.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyRsaTokenKey. +func (c ContentKeyPolicyRsaTokenKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateByteArray(objectMap, "exponent", c.Exponent, runtime.Base64StdFormat) + populateByteArray(objectMap, "modulus", c.Modulus, runtime.Base64StdFormat) + objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyRsaTokenKey" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyRsaTokenKey. +func (c *ContentKeyPolicyRsaTokenKey) 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 "exponent": + err = runtime.DecodeByteArray(string(val), &c.Exponent, runtime.Base64StdFormat) + delete(rawMsg, key) + case "modulus": + err = runtime.DecodeByteArray(string(val), &c.Modulus, runtime.Base64StdFormat) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetContentKeyPolicyRestrictionTokenKey implements the ContentKeyPolicyRestrictionTokenKeyClassification interface for type +// ContentKeyPolicySymmetricTokenKey. +func (c *ContentKeyPolicySymmetricTokenKey) GetContentKeyPolicyRestrictionTokenKey() *ContentKeyPolicyRestrictionTokenKey { + return &ContentKeyPolicyRestrictionTokenKey{ + ODataType: c.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicySymmetricTokenKey. +func (c ContentKeyPolicySymmetricTokenKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateByteArray(objectMap, "keyValue", c.KeyValue, runtime.Base64StdFormat) + objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicySymmetricTokenKey. +func (c *ContentKeyPolicySymmetricTokenKey) 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 "keyValue": + err = runtime.DecodeByteArray(string(val), &c.KeyValue, runtime.Base64StdFormat) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetContentKeyPolicyRestriction implements the ContentKeyPolicyRestrictionClassification interface for type ContentKeyPolicyTokenRestriction. +func (c *ContentKeyPolicyTokenRestriction) GetContentKeyPolicyRestriction() *ContentKeyPolicyRestriction { + return &ContentKeyPolicyRestriction{ + ODataType: c.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyTokenRestriction. +func (c ContentKeyPolicyTokenRestriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alternateVerificationKeys", c.AlternateVerificationKeys) + populate(objectMap, "audience", c.Audience) + populate(objectMap, "issuer", c.Issuer) + objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyTokenRestriction" + populate(objectMap, "openIdConnectDiscoveryDocument", c.OpenIDConnectDiscoveryDocument) + populate(objectMap, "primaryVerificationKey", c.PrimaryVerificationKey) + populate(objectMap, "requiredClaims", c.RequiredClaims) + populate(objectMap, "restrictionTokenType", c.RestrictionTokenType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyTokenRestriction. +func (c *ContentKeyPolicyTokenRestriction) 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 "alternateVerificationKeys": + c.AlternateVerificationKeys, err = unmarshalContentKeyPolicyRestrictionTokenKeyClassificationArray(val) + delete(rawMsg, key) + case "audience": + err = unpopulate(val, &c.Audience) + delete(rawMsg, key) + case "issuer": + err = unpopulate(val, &c.Issuer) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + case "openIdConnectDiscoveryDocument": + err = unpopulate(val, &c.OpenIDConnectDiscoveryDocument) + delete(rawMsg, key) + case "primaryVerificationKey": + c.PrimaryVerificationKey, err = unmarshalContentKeyPolicyRestrictionTokenKeyClassification(val) + delete(rawMsg, key) + case "requiredClaims": + err = unpopulate(val, &c.RequiredClaims) + delete(rawMsg, key) + case "restrictionTokenType": + err = unpopulate(val, &c.RestrictionTokenType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetContentKeyPolicyConfiguration implements the ContentKeyPolicyConfigurationClassification interface for type ContentKeyPolicyUnknownConfiguration. +func (c *ContentKeyPolicyUnknownConfiguration) GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration { + return &ContentKeyPolicyConfiguration{ + ODataType: c.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyUnknownConfiguration. +func (c ContentKeyPolicyUnknownConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyUnknownConfiguration" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyUnknownConfiguration. +func (c *ContentKeyPolicyUnknownConfiguration) 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 "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetContentKeyPolicyRestriction implements the ContentKeyPolicyRestrictionClassification interface for type ContentKeyPolicyUnknownRestriction. +func (c *ContentKeyPolicyUnknownRestriction) GetContentKeyPolicyRestriction() *ContentKeyPolicyRestriction { + return &ContentKeyPolicyRestriction{ + ODataType: c.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyUnknownRestriction. +func (c ContentKeyPolicyUnknownRestriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyUnknownRestriction" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyUnknownRestriction. +func (c *ContentKeyPolicyUnknownRestriction) 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 "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetContentKeyPolicyConfiguration implements the ContentKeyPolicyConfigurationClassification interface for type ContentKeyPolicyWidevineConfiguration. +func (c *ContentKeyPolicyWidevineConfiguration) GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration { + return &ContentKeyPolicyConfiguration{ + ODataType: c.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyWidevineConfiguration. +func (c ContentKeyPolicyWidevineConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration" + populate(objectMap, "widevineTemplate", c.WidevineTemplate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyWidevineConfiguration. +func (c *ContentKeyPolicyWidevineConfiguration) 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 "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + case "widevineTemplate": + err = unpopulate(val, &c.WidevineTemplate) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetContentKeyPolicyRestrictionTokenKey implements the ContentKeyPolicyRestrictionTokenKeyClassification interface for type +// ContentKeyPolicyX509CertificateTokenKey. +func (c *ContentKeyPolicyX509CertificateTokenKey) GetContentKeyPolicyRestrictionTokenKey() *ContentKeyPolicyRestrictionTokenKey { + return &ContentKeyPolicyRestrictionTokenKey{ + ODataType: c.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyX509CertificateTokenKey. +func (c ContentKeyPolicyX509CertificateTokenKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey" + populateByteArray(objectMap, "rawBody", c.RawBody, runtime.Base64StdFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyX509CertificateTokenKey. +func (c *ContentKeyPolicyX509CertificateTokenKey) 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 "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + case "rawBody": + err = runtime.DecodeByteArray(string(val), &c.RawBody, runtime.Base64StdFormat) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetCodec implements the CodecClassification interface for type CopyAudio. +func (c *CopyAudio) GetCodec() *Codec { + return &Codec{ + ODataType: c.ODataType, + Label: c.Label, + } +} + +// MarshalJSON implements the json.Marshaller interface for type CopyAudio. +func (c CopyAudio) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "label", c.Label) + objectMap["@odata.type"] = "#Microsoft.Media.CopyAudio" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CopyAudio. +func (c *CopyAudio) 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 "label": + err = unpopulate(val, &c.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetCodec implements the CodecClassification interface for type CopyVideo. +func (c *CopyVideo) GetCodec() *Codec { + return &Codec{ + ODataType: c.ODataType, + Label: c.Label, + } +} + +// MarshalJSON implements the json.Marshaller interface for type CopyVideo. +func (c CopyVideo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "label", c.Label) + objectMap["@odata.type"] = "#Microsoft.Media.CopyVideo" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CopyVideo. +func (c *CopyVideo) 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 "label": + err = unpopulate(val, &c.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnvelopeEncryption. +func (e EnvelopeEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clearTracks", e.ClearTracks) + populate(objectMap, "contentKeys", e.ContentKeys) + populate(objectMap, "customKeyAcquisitionUrlTemplate", e.CustomKeyAcquisitionURLTemplate) + populate(objectMap, "enabledProtocols", e.EnabledProtocols) + return json.Marshal(objectMap) +} + +// 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) +} + +// GetPreset implements the PresetClassification interface for type FaceDetectorPreset. +func (f *FaceDetectorPreset) GetPreset() *Preset { + return &Preset{ + ODataType: f.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type FaceDetectorPreset. +func (f FaceDetectorPreset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blurType", f.BlurType) + populate(objectMap, "experimentalOptions", f.ExperimentalOptions) + populate(objectMap, "mode", f.Mode) + objectMap["@odata.type"] = "#Microsoft.Media.FaceDetectorPreset" + populate(objectMap, "resolution", f.Resolution) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FaceDetectorPreset. +func (f *FaceDetectorPreset) 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 "blurType": + err = unpopulate(val, &f.BlurType) + delete(rawMsg, key) + case "experimentalOptions": + err = unpopulate(val, &f.ExperimentalOptions) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, &f.Mode) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &f.ODataType) + delete(rawMsg, key) + case "resolution": + err = unpopulate(val, &f.Resolution) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FilterTrackSelection. +func (f FilterTrackSelection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "trackSelections", f.TrackSelections) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Filters. +func (f Filters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "crop", f.Crop) + populate(objectMap, "deinterlace", f.Deinterlace) + populate(objectMap, "overlays", f.Overlays) + populate(objectMap, "rotation", f.Rotation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Filters. +func (f *Filters) 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 "crop": + err = unpopulate(val, &f.Crop) + delete(rawMsg, key) + case "deinterlace": + err = unpopulate(val, &f.Deinterlace) + delete(rawMsg, key) + case "overlays": + f.Overlays, err = unmarshalOverlayClassificationArray(val) + delete(rawMsg, key) + case "rotation": + err = unpopulate(val, &f.Rotation) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetFormat implements the FormatClassification interface for type Format. +func (f *Format) GetFormat() *Format { return f } + +// GetInputDefinition implements the InputDefinitionClassification interface for type FromAllInputFile. +func (f *FromAllInputFile) GetInputDefinition() *InputDefinition { + return &InputDefinition{ + ODataType: f.ODataType, + IncludedTracks: f.IncludedTracks, + } +} + +// MarshalJSON implements the json.Marshaller interface for type FromAllInputFile. +func (f FromAllInputFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "includedTracks", f.IncludedTracks) + objectMap["@odata.type"] = "#Microsoft.Media.FromAllInputFile" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FromAllInputFile. +func (f *FromAllInputFile) 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 "includedTracks": + f.IncludedTracks, err = unmarshalTrackDescriptorClassificationArray(val) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &f.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetInputDefinition implements the InputDefinitionClassification interface for type FromEachInputFile. +func (f *FromEachInputFile) GetInputDefinition() *InputDefinition { + return &InputDefinition{ + ODataType: f.ODataType, + IncludedTracks: f.IncludedTracks, + } +} + +// MarshalJSON implements the json.Marshaller interface for type FromEachInputFile. +func (f FromEachInputFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "includedTracks", f.IncludedTracks) + objectMap["@odata.type"] = "#Microsoft.Media.FromEachInputFile" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FromEachInputFile. +func (f *FromEachInputFile) 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 "includedTracks": + f.IncludedTracks, err = unmarshalTrackDescriptorClassificationArray(val) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &f.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetCodec implements the CodecClassification interface for type H264Video. +func (h *H264Video) GetCodec() *Codec { + return &Codec{ + ODataType: h.ODataType, + Label: h.Label, + } +} + +// GetVideo implements the VideoClassification interface for type H264Video. +func (h *H264Video) GetVideo() *Video { + return &Video{ + KeyFrameInterval: h.KeyFrameInterval, + StretchMode: h.StretchMode, + SyncMode: h.SyncMode, + ODataType: h.ODataType, + Label: h.Label, + } +} + +// MarshalJSON implements the json.Marshaller interface for type H264Video. +func (h H264Video) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "complexity", h.Complexity) + populate(objectMap, "keyFrameInterval", h.KeyFrameInterval) + populate(objectMap, "label", h.Label) + populate(objectMap, "layers", h.Layers) + objectMap["@odata.type"] = "#Microsoft.Media.H264Video" + populate(objectMap, "rateControlMode", h.RateControlMode) + populate(objectMap, "sceneChangeDetection", h.SceneChangeDetection) + populate(objectMap, "stretchMode", h.StretchMode) + populate(objectMap, "syncMode", h.SyncMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type H264Video. +func (h *H264Video) 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 "complexity": + err = unpopulate(val, &h.Complexity) + delete(rawMsg, key) + case "keyFrameInterval": + err = unpopulate(val, &h.KeyFrameInterval) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &h.Label) + delete(rawMsg, key) + case "layers": + err = unpopulate(val, &h.Layers) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &h.ODataType) + delete(rawMsg, key) + case "rateControlMode": + err = unpopulate(val, &h.RateControlMode) + delete(rawMsg, key) + case "sceneChangeDetection": + err = unpopulate(val, &h.SceneChangeDetection) + delete(rawMsg, key) + case "stretchMode": + err = unpopulate(val, &h.StretchMode) + delete(rawMsg, key) + case "syncMode": + err = unpopulate(val, &h.SyncMode) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetCodec implements the CodecClassification interface for type H265Video. +func (h *H265Video) GetCodec() *Codec { + return &Codec{ + ODataType: h.ODataType, + Label: h.Label, + } +} + +// GetVideo implements the VideoClassification interface for type H265Video. +func (h *H265Video) GetVideo() *Video { + return &Video{ + KeyFrameInterval: h.KeyFrameInterval, + StretchMode: h.StretchMode, + SyncMode: h.SyncMode, + ODataType: h.ODataType, + Label: h.Label, + } +} + +// MarshalJSON implements the json.Marshaller interface for type H265Video. +func (h H265Video) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "complexity", h.Complexity) + populate(objectMap, "keyFrameInterval", h.KeyFrameInterval) + populate(objectMap, "label", h.Label) + populate(objectMap, "layers", h.Layers) + objectMap["@odata.type"] = "#Microsoft.Media.H265Video" + populate(objectMap, "sceneChangeDetection", h.SceneChangeDetection) + populate(objectMap, "stretchMode", h.StretchMode) + populate(objectMap, "syncMode", h.SyncMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type H265Video. +func (h *H265Video) 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 "complexity": + err = unpopulate(val, &h.Complexity) + delete(rawMsg, key) + case "keyFrameInterval": + err = unpopulate(val, &h.KeyFrameInterval) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &h.Label) + delete(rawMsg, key) + case "layers": + err = unpopulate(val, &h.Layers) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &h.ODataType) + delete(rawMsg, key) + case "sceneChangeDetection": + err = unpopulate(val, &h.SceneChangeDetection) + delete(rawMsg, key) + case "stretchMode": + err = unpopulate(val, &h.StretchMode) + delete(rawMsg, key) + case "syncMode": + err = unpopulate(val, &h.SyncMode) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPAccessControl. +func (i IPAccessControl) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allow", i.Allow) + return json.Marshal(objectMap) +} + +// GetCodec implements the CodecClassification interface for type Image. +func (i *Image) GetCodec() *Codec { + return &Codec{ + ODataType: i.ODataType, + Label: i.Label, + } +} + +// GetImage implements the ImageClassification interface for type Image. +func (i *Image) GetImage() *Image { return i } + +// GetVideo implements the VideoClassification interface for type Image. +func (i *Image) GetVideo() *Video { + return &Video{ + KeyFrameInterval: i.KeyFrameInterval, + StretchMode: i.StretchMode, + SyncMode: i.SyncMode, + ODataType: i.ODataType, + Label: i.Label, + } +} + +// MarshalJSON implements the json.Marshaller interface for type Image. +func (i Image) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyFrameInterval", i.KeyFrameInterval) + populate(objectMap, "label", i.Label) + objectMap["@odata.type"] = "#Microsoft.Media.Image" + populate(objectMap, "range", i.Range) + populate(objectMap, "start", i.Start) + populate(objectMap, "step", i.Step) + populate(objectMap, "stretchMode", i.StretchMode) + populate(objectMap, "syncMode", i.SyncMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Image. +func (i *Image) 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 "keyFrameInterval": + err = unpopulate(val, &i.KeyFrameInterval) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &i.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &i.ODataType) + delete(rawMsg, key) + case "range": + err = unpopulate(val, &i.Range) + delete(rawMsg, key) + case "start": + err = unpopulate(val, &i.Start) + delete(rawMsg, key) + case "step": + err = unpopulate(val, &i.Step) + delete(rawMsg, key) + case "stretchMode": + err = unpopulate(val, &i.StretchMode) + delete(rawMsg, key) + case "syncMode": + err = unpopulate(val, &i.SyncMode) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetFormat implements the FormatClassification interface for type ImageFormat. +func (i *ImageFormat) GetFormat() *Format { + return &Format{ + ODataType: i.ODataType, + FilenamePattern: i.FilenamePattern, + } +} + +// GetImageFormat implements the ImageFormatClassification interface for type ImageFormat. +func (i *ImageFormat) GetImageFormat() *ImageFormat { return i } + +// MarshalJSON implements the json.Marshaller interface for type ImageFormat. +func (i ImageFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filenamePattern", i.FilenamePattern) + objectMap["@odata.type"] = "#Microsoft.Media.ImageFormat" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageFormat. +func (i *ImageFormat) 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 "filenamePattern": + err = unpopulate(val, &i.FilenamePattern) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &i.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetInputDefinition implements the InputDefinitionClassification interface for type InputDefinition. +func (i *InputDefinition) GetInputDefinition() *InputDefinition { return i } + +// MarshalJSON implements the json.Marshaller interface for type InputDefinition. +func (i InputDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "includedTracks", i.IncludedTracks) + objectMap["@odata.type"] = i.ODataType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InputDefinition. +func (i *InputDefinition) 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 "includedTracks": + i.IncludedTracks, err = unmarshalTrackDescriptorClassificationArray(val) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &i.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetInputDefinition implements the InputDefinitionClassification interface for type InputFile. +func (i *InputFile) GetInputDefinition() *InputDefinition { + return &InputDefinition{ + ODataType: i.ODataType, + IncludedTracks: i.IncludedTracks, + } +} + +// MarshalJSON implements the json.Marshaller interface for type InputFile. +func (i InputFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filename", i.Filename) + populate(objectMap, "includedTracks", i.IncludedTracks) + objectMap["@odata.type"] = "#Microsoft.Media.InputFile" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InputFile. +func (i *InputFile) 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 "filename": + err = unpopulate(val, &i.Filename) + delete(rawMsg, key) + case "includedTracks": + i.IncludedTracks, err = unmarshalTrackDescriptorClassificationArray(val) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &i.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Job. +func (j Job) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", j.ID) + populate(objectMap, "name", j.Name) + populate(objectMap, "properties", j.Properties) + populate(objectMap, "systemData", j.SystemData) + populate(objectMap, "type", j.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type JobCollection. +func (j JobCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", j.ODataNextLink) + populate(objectMap, "value", j.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type JobError. +func (j JobError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "category", j.Category) + populate(objectMap, "code", j.Code) + populate(objectMap, "details", j.Details) + populate(objectMap, "message", j.Message) + populate(objectMap, "retry", j.Retry) + return json.Marshal(objectMap) +} + +// GetJobInput implements the JobInputClassification interface for type JobInput. +func (j *JobInput) GetJobInput() *JobInput { return j } + +// GetJobInput implements the JobInputClassification interface for type JobInputAsset. +func (j *JobInputAsset) GetJobInput() *JobInput { + return &JobInput{ + ODataType: j.ODataType, + } +} + +// GetJobInputClip implements the JobInputClipClassification interface for type JobInputAsset. +func (j *JobInputAsset) GetJobInputClip() *JobInputClip { + return &JobInputClip{ + Files: j.Files, + Start: j.Start, + End: j.End, + Label: j.Label, + InputDefinitions: j.InputDefinitions, + ODataType: j.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type JobInputAsset. +func (j JobInputAsset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assetName", j.AssetName) + populate(objectMap, "end", j.End) + populate(objectMap, "files", j.Files) + populate(objectMap, "inputDefinitions", j.InputDefinitions) + populate(objectMap, "label", j.Label) + objectMap["@odata.type"] = "#Microsoft.Media.JobInputAsset" + populate(objectMap, "start", j.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputAsset. +func (j *JobInputAsset) 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 "assetName": + err = unpopulate(val, &j.AssetName) + delete(rawMsg, key) + case "end": + j.End, err = unmarshalClipTimeClassification(val) + delete(rawMsg, key) + case "files": + err = unpopulate(val, &j.Files) + delete(rawMsg, key) + case "inputDefinitions": + j.InputDefinitions, err = unmarshalInputDefinitionClassificationArray(val) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &j.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &j.ODataType) + delete(rawMsg, key) + case "start": + j.Start, err = unmarshalClipTimeClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetJobInput implements the JobInputClassification interface for type JobInputClip. +func (j *JobInputClip) GetJobInput() *JobInput { + return &JobInput{ + ODataType: j.ODataType, + } +} + +// GetJobInputClip implements the JobInputClipClassification interface for type JobInputClip. +func (j *JobInputClip) GetJobInputClip() *JobInputClip { return j } + +// MarshalJSON implements the json.Marshaller interface for type JobInputClip. +func (j JobInputClip) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "end", j.End) + populate(objectMap, "files", j.Files) + populate(objectMap, "inputDefinitions", j.InputDefinitions) + populate(objectMap, "label", j.Label) + objectMap["@odata.type"] = "#Microsoft.Media.JobInputClip" + populate(objectMap, "start", j.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputClip. +func (j *JobInputClip) 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 "end": + j.End, err = unmarshalClipTimeClassification(val) + delete(rawMsg, key) + case "files": + err = unpopulate(val, &j.Files) + delete(rawMsg, key) + case "inputDefinitions": + j.InputDefinitions, err = unmarshalInputDefinitionClassificationArray(val) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &j.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &j.ODataType) + delete(rawMsg, key) + case "start": + j.Start, err = unmarshalClipTimeClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetJobInput implements the JobInputClassification interface for type JobInputHTTP. +func (j *JobInputHTTP) GetJobInput() *JobInput { + return &JobInput{ + ODataType: j.ODataType, + } +} + +// GetJobInputClip implements the JobInputClipClassification interface for type JobInputHTTP. +func (j *JobInputHTTP) GetJobInputClip() *JobInputClip { + return &JobInputClip{ + Files: j.Files, + Start: j.Start, + End: j.End, + Label: j.Label, + InputDefinitions: j.InputDefinitions, + ODataType: j.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type JobInputHTTP. +func (j JobInputHTTP) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "baseUri", j.BaseURI) + populate(objectMap, "end", j.End) + populate(objectMap, "files", j.Files) + populate(objectMap, "inputDefinitions", j.InputDefinitions) + populate(objectMap, "label", j.Label) + objectMap["@odata.type"] = "#Microsoft.Media.JobInputHttp" + populate(objectMap, "start", j.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputHTTP. +func (j *JobInputHTTP) 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 "baseUri": + err = unpopulate(val, &j.BaseURI) + delete(rawMsg, key) + case "end": + j.End, err = unmarshalClipTimeClassification(val) + delete(rawMsg, key) + case "files": + err = unpopulate(val, &j.Files) + delete(rawMsg, key) + case "inputDefinitions": + j.InputDefinitions, err = unmarshalInputDefinitionClassificationArray(val) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &j.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &j.ODataType) + delete(rawMsg, key) + case "start": + j.Start, err = unmarshalClipTimeClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetJobInput implements the JobInputClassification interface for type JobInputSequence. +func (j *JobInputSequence) GetJobInput() *JobInput { + return &JobInput{ + ODataType: j.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type JobInputSequence. +func (j JobInputSequence) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inputs", j.Inputs) + objectMap["@odata.type"] = "#Microsoft.Media.JobInputSequence" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputSequence. +func (j *JobInputSequence) 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 "inputs": + j.Inputs, err = unmarshalJobInputClipClassificationArray(val) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &j.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetJobInput implements the JobInputClassification interface for type JobInputs. +func (j *JobInputs) GetJobInput() *JobInput { + return &JobInput{ + ODataType: j.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type JobInputs. +func (j JobInputs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inputs", j.Inputs) + objectMap["@odata.type"] = "#Microsoft.Media.JobInputs" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputs. +func (j *JobInputs) 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 "inputs": + j.Inputs, err = unmarshalJobInputClassificationArray(val) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &j.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetJobOutput implements the JobOutputClassification interface for type JobOutput. +func (j *JobOutput) GetJobOutput() *JobOutput { return j } + +// MarshalJSON implements the json.Marshaller interface for type JobOutput. +func (j JobOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", j.EndTime) + populate(objectMap, "error", j.Error) + populate(objectMap, "label", j.Label) + objectMap["@odata.type"] = j.ODataType + populate(objectMap, "presetOverride", j.PresetOverride) + populate(objectMap, "progress", j.Progress) + populateTimeRFC3339(objectMap, "startTime", j.StartTime) + populate(objectMap, "state", j.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobOutput. +func (j *JobOutput) 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 "endTime": + err = unpopulateTimeRFC3339(val, &j.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, &j.Error) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &j.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &j.ODataType) + delete(rawMsg, key) + case "presetOverride": + j.PresetOverride, err = unmarshalPresetClassification(val) + delete(rawMsg, key) + case "progress": + err = unpopulate(val, &j.Progress) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &j.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, &j.State) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetJobOutput implements the JobOutputClassification interface for type JobOutputAsset. +func (j *JobOutputAsset) GetJobOutput() *JobOutput { + return &JobOutput{ + ODataType: j.ODataType, + Error: j.Error, + PresetOverride: j.PresetOverride, + State: j.State, + Progress: j.Progress, + Label: j.Label, + StartTime: j.StartTime, + EndTime: j.EndTime, + } +} + +// MarshalJSON implements the json.Marshaller interface for type JobOutputAsset. +func (j JobOutputAsset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assetName", j.AssetName) + populateTimeRFC3339(objectMap, "endTime", j.EndTime) + populate(objectMap, "error", j.Error) + populate(objectMap, "label", j.Label) + objectMap["@odata.type"] = "#Microsoft.Media.JobOutputAsset" + populate(objectMap, "presetOverride", j.PresetOverride) + populate(objectMap, "progress", j.Progress) + populateTimeRFC3339(objectMap, "startTime", j.StartTime) + populate(objectMap, "state", j.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobOutputAsset. +func (j *JobOutputAsset) 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 "assetName": + err = unpopulate(val, &j.AssetName) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, &j.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, &j.Error) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &j.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &j.ODataType) + delete(rawMsg, key) + case "presetOverride": + j.PresetOverride, err = unmarshalPresetClassification(val) + delete(rawMsg, key) + case "progress": + err = unpopulate(val, &j.Progress) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &j.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, &j.State) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobProperties. +func (j JobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "correlationData", j.CorrelationData) + populateTimeRFC3339(objectMap, "created", j.Created) + populate(objectMap, "description", j.Description) + populateTimeRFC3339(objectMap, "endTime", j.EndTime) + populate(objectMap, "input", j.Input) + populateTimeRFC3339(objectMap, "lastModified", j.LastModified) + populate(objectMap, "outputs", j.Outputs) + populate(objectMap, "priority", j.Priority) + populateTimeRFC3339(objectMap, "startTime", j.StartTime) + populate(objectMap, "state", j.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobProperties. +func (j *JobProperties) 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 "correlationData": + err = unpopulate(val, &j.CorrelationData) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC3339(val, &j.Created) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &j.Description) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, &j.EndTime) + delete(rawMsg, key) + case "input": + j.Input, err = unmarshalJobInputClassification(val) + delete(rawMsg, key) + case "lastModified": + err = unpopulateTimeRFC3339(val, &j.LastModified) + delete(rawMsg, key) + case "outputs": + j.Outputs, err = unmarshalJobOutputClassificationArray(val) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, &j.Priority) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &j.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, &j.State) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetFormat implements the FormatClassification interface for type JpgFormat. +func (j *JpgFormat) GetFormat() *Format { + return &Format{ + ODataType: j.ODataType, + FilenamePattern: j.FilenamePattern, + } +} + +// GetImageFormat implements the ImageFormatClassification interface for type JpgFormat. +func (j *JpgFormat) GetImageFormat() *ImageFormat { + return &ImageFormat{ + ODataType: j.ODataType, + FilenamePattern: j.FilenamePattern, + } +} + +// MarshalJSON implements the json.Marshaller interface for type JpgFormat. +func (j JpgFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filenamePattern", j.FilenamePattern) + objectMap["@odata.type"] = "#Microsoft.Media.JpgFormat" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JpgFormat. +func (j *JpgFormat) 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 "filenamePattern": + err = unpopulate(val, &j.FilenamePattern) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &j.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetCodec implements the CodecClassification interface for type JpgImage. +func (j *JpgImage) GetCodec() *Codec { + return &Codec{ + ODataType: j.ODataType, + Label: j.Label, + } +} + +// GetImage implements the ImageClassification interface for type JpgImage. +func (j *JpgImage) GetImage() *Image { + return &Image{ + Start: j.Start, + Step: j.Step, + Range: j.Range, + KeyFrameInterval: j.KeyFrameInterval, + StretchMode: j.StretchMode, + SyncMode: j.SyncMode, + ODataType: j.ODataType, + Label: j.Label, + } +} + +// GetVideo implements the VideoClassification interface for type JpgImage. +func (j *JpgImage) GetVideo() *Video { + return &Video{ + KeyFrameInterval: j.KeyFrameInterval, + StretchMode: j.StretchMode, + SyncMode: j.SyncMode, + ODataType: j.ODataType, + Label: j.Label, + } +} + +// MarshalJSON implements the json.Marshaller interface for type JpgImage. +func (j JpgImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyFrameInterval", j.KeyFrameInterval) + populate(objectMap, "label", j.Label) + populate(objectMap, "layers", j.Layers) + objectMap["@odata.type"] = "#Microsoft.Media.JpgImage" + populate(objectMap, "range", j.Range) + populate(objectMap, "spriteColumn", j.SpriteColumn) + populate(objectMap, "start", j.Start) + populate(objectMap, "step", j.Step) + populate(objectMap, "stretchMode", j.StretchMode) + populate(objectMap, "syncMode", j.SyncMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JpgImage. +func (j *JpgImage) 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 "keyFrameInterval": + err = unpopulate(val, &j.KeyFrameInterval) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &j.Label) + delete(rawMsg, key) + case "layers": + err = unpopulate(val, &j.Layers) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &j.ODataType) + delete(rawMsg, key) + case "range": + err = unpopulate(val, &j.Range) + delete(rawMsg, key) + case "spriteColumn": + err = unpopulate(val, &j.SpriteColumn) + delete(rawMsg, key) + case "start": + err = unpopulate(val, &j.Start) + delete(rawMsg, key) + case "step": + err = unpopulate(val, &j.Step) + delete(rawMsg, key) + case "stretchMode": + err = unpopulate(val, &j.StretchMode) + delete(rawMsg, key) + case "syncMode": + err = unpopulate(val, &j.SyncMode) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListContainerSasInput. +func (l ListContainerSasInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "expiryTime", l.ExpiryTime) + populate(objectMap, "permissions", l.Permissions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListContainerSasInput. +func (l *ListContainerSasInput) 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 "expiryTime": + err = unpopulateTimeRFC3339(val, &l.ExpiryTime) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, &l.Permissions) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListContentKeysResponse. +func (l ListContentKeysResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contentKeys", l.ContentKeys) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ListPathsResponse. +func (l ListPathsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "downloadPaths", l.DownloadPaths) + populate(objectMap, "streamingPaths", l.StreamingPaths) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ListStreamingLocatorsResponse. +func (l ListStreamingLocatorsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "streamingLocators", l.StreamingLocators) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type LiveEvent. +func (l LiveEvent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", l.ID) + populate(objectMap, "location", l.Location) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "tags", l.Tags) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type LiveEventInput. +func (l LiveEventInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessControl", l.AccessControl) + populate(objectMap, "accessToken", l.AccessToken) + populate(objectMap, "endpoints", l.Endpoints) + populate(objectMap, "keyFrameIntervalDuration", l.KeyFrameIntervalDuration) + populate(objectMap, "streamingProtocol", l.StreamingProtocol) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type LiveEventListResult. +func (l LiveEventListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.count", l.ODataCount) + populate(objectMap, "@odata.nextLink", l.ODataNextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type LiveEventPreview. +func (l LiveEventPreview) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessControl", l.AccessControl) + populate(objectMap, "alternativeMediaId", l.AlternativeMediaID) + populate(objectMap, "endpoints", l.Endpoints) + populate(objectMap, "previewLocator", l.PreviewLocator) + populate(objectMap, "streamingPolicyName", l.StreamingPolicyName) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type LiveEventProperties. +func (l LiveEventProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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) + populateTimeRFC3339(objectMap, "lastModified", l.LastModified) + populate(objectMap, "preview", l.Preview) + populate(objectMap, "provisioningState", l.ProvisioningState) + populate(objectMap, "resourceState", l.ResourceState) + populate(objectMap, "streamOptions", l.StreamOptions) + populate(objectMap, "transcriptions", l.Transcriptions) + populate(objectMap, "useStaticHostname", l.UseStaticHostname) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LiveEventProperties. +func (l *LiveEventProperties) 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 "created": + err = unpopulateTimeRFC3339(val, &l.Created) + delete(rawMsg, key) + case "crossSiteAccessPolicies": + err = unpopulate(val, &l.CrossSiteAccessPolicies) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &l.Description) + delete(rawMsg, key) + case "encoding": + err = unpopulate(val, &l.Encoding) + delete(rawMsg, key) + case "hostnamePrefix": + err = unpopulate(val, &l.HostnamePrefix) + delete(rawMsg, key) + case "input": + err = unpopulate(val, &l.Input) + delete(rawMsg, key) + case "lastModified": + err = unpopulateTimeRFC3339(val, &l.LastModified) + delete(rawMsg, key) + case "preview": + err = unpopulate(val, &l.Preview) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &l.ProvisioningState) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, &l.ResourceState) + delete(rawMsg, key) + case "streamOptions": + err = unpopulate(val, &l.StreamOptions) + delete(rawMsg, key) + case "transcriptions": + err = unpopulate(val, &l.Transcriptions) + delete(rawMsg, key) + case "useStaticHostname": + err = unpopulate(val, &l.UseStaticHostname) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LiveEventTranscription. +func (l LiveEventTranscription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inputTrackSelection", l.InputTrackSelection) + populate(objectMap, "language", l.Language) + populate(objectMap, "outputTranscriptionTrack", l.OutputTranscriptionTrack) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type LiveOutputListResult. +func (l LiveOutputListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.count", l.ODataCount) + populate(objectMap, "@odata.nextLink", l.ODataNextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type LiveOutputProperties. +func (l LiveOutputProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "archiveWindowLength", l.ArchiveWindowLength) + populate(objectMap, "assetName", l.AssetName) + populateTimeRFC3339(objectMap, "created", l.Created) + populate(objectMap, "description", l.Description) + populate(objectMap, "hls", l.Hls) + populateTimeRFC3339(objectMap, "lastModified", l.LastModified) + populate(objectMap, "manifestName", l.ManifestName) + populate(objectMap, "outputSnapTime", l.OutputSnapTime) + populate(objectMap, "provisioningState", l.ProvisioningState) + populate(objectMap, "resourceState", l.ResourceState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LiveOutputProperties. +func (l *LiveOutputProperties) 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 "archiveWindowLength": + err = unpopulate(val, &l.ArchiveWindowLength) + delete(rawMsg, key) + case "assetName": + err = unpopulate(val, &l.AssetName) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC3339(val, &l.Created) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &l.Description) + delete(rawMsg, key) + case "hls": + err = unpopulate(val, &l.Hls) + delete(rawMsg, key) + case "lastModified": + err = unpopulateTimeRFC3339(val, &l.LastModified) + delete(rawMsg, key) + case "manifestName": + err = unpopulate(val, &l.ManifestName) + delete(rawMsg, key) + case "outputSnapTime": + err = unpopulate(val, &l.OutputSnapTime) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &l.ProvisioningState) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, &l.ResourceState) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MediaFilterProperties. +func (m MediaFilterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "firstQuality", m.FirstQuality) + populate(objectMap, "presentationTimeRange", m.PresentationTimeRange) + populate(objectMap, "tracks", m.Tracks) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MediaService. +func (m MediaService) MarshalJSON() ([]byte, error) { + objectMap := make(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, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MediaServiceCollection. +func (m MediaServiceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", m.ODataNextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MediaServiceIdentity. +func (m MediaServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MediaServiceProperties. +func (m MediaServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encryption", m.Encryption) + populate(objectMap, "keyDelivery", m.KeyDelivery) + populate(objectMap, "mediaServiceId", m.MediaServiceID) + populate(objectMap, "publicNetworkAccess", m.PublicNetworkAccess) + populate(objectMap, "storageAccounts", m.StorageAccounts) + populate(objectMap, "storageAuthentication", m.StorageAuthentication) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MediaServiceUpdate. +func (m MediaServiceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. +func (m MetricSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "enableRegionalMdmAccount", m.EnableRegionalMdmAccount) + populate(objectMap, "lockAggregationType", m.LockAggregationType) + populate(objectMap, "name", m.Name) + populate(objectMap, "sourceMdmAccount", m.SourceMdmAccount) + populate(objectMap, "sourceMdmNamespace", m.SourceMdmNamespace) + populate(objectMap, "supportedAggregationTypes", m.SupportedAggregationTypes) + populate(objectMap, "supportedTimeGrainTypes", m.SupportedTimeGrainTypes) + populate(objectMap, "unit", m.Unit) + return json.Marshal(objectMap) +} + +// GetFormat implements the FormatClassification interface for type Mp4Format. +func (m *Mp4Format) GetFormat() *Format { + return &Format{ + ODataType: m.ODataType, + FilenamePattern: m.FilenamePattern, + } +} + +// GetMultiBitrateFormat implements the MultiBitrateFormatClassification interface for type Mp4Format. +func (m *Mp4Format) GetMultiBitrateFormat() *MultiBitrateFormat { + return &MultiBitrateFormat{ + OutputFiles: m.OutputFiles, + ODataType: m.ODataType, + FilenamePattern: m.FilenamePattern, + } +} + +// MarshalJSON implements the json.Marshaller interface for type Mp4Format. +func (m Mp4Format) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filenamePattern", m.FilenamePattern) + objectMap["@odata.type"] = "#Microsoft.Media.Mp4Format" + populate(objectMap, "outputFiles", m.OutputFiles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Mp4Format. +func (m *Mp4Format) 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 "filenamePattern": + err = unpopulate(val, &m.FilenamePattern) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &m.ODataType) + delete(rawMsg, key) + case "outputFiles": + err = unpopulate(val, &m.OutputFiles) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetFormat implements the FormatClassification interface for type MultiBitrateFormat. +func (m *MultiBitrateFormat) GetFormat() *Format { + return &Format{ + ODataType: m.ODataType, + FilenamePattern: m.FilenamePattern, + } +} + +// GetMultiBitrateFormat implements the MultiBitrateFormatClassification interface for type MultiBitrateFormat. +func (m *MultiBitrateFormat) GetMultiBitrateFormat() *MultiBitrateFormat { return m } + +// MarshalJSON implements the json.Marshaller interface for type MultiBitrateFormat. +func (m MultiBitrateFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filenamePattern", m.FilenamePattern) + objectMap["@odata.type"] = "#Microsoft.Media.MultiBitrateFormat" + populate(objectMap, "outputFiles", m.OutputFiles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MultiBitrateFormat. +func (m *MultiBitrateFormat) 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 "filenamePattern": + err = unpopulate(val, &m.FilenamePattern) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &m.ODataType) + delete(rawMsg, key) + case "outputFiles": + err = unpopulate(val, &m.OutputFiles) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationCollection. +func (o OperationCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OutputFile. +func (o OutputFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "labels", o.Labels) + return json.Marshal(objectMap) +} + +// GetOverlay implements the OverlayClassification interface for type Overlay. +func (o *Overlay) GetOverlay() *Overlay { return o } + +// GetFormat implements the FormatClassification interface for type PNGFormat. +func (p *PNGFormat) GetFormat() *Format { + return &Format{ + ODataType: p.ODataType, + FilenamePattern: p.FilenamePattern, + } +} + +// GetImageFormat implements the ImageFormatClassification interface for type PNGFormat. +func (p *PNGFormat) GetImageFormat() *ImageFormat { + return &ImageFormat{ + ODataType: p.ODataType, + FilenamePattern: p.FilenamePattern, + } +} + +// MarshalJSON implements the json.Marshaller interface for type PNGFormat. +func (p PNGFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filenamePattern", p.FilenamePattern) + objectMap["@odata.type"] = "#Microsoft.Media.PngFormat" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PNGFormat. +func (p *PNGFormat) 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 "filenamePattern": + err = unpopulate(val, &p.FilenamePattern) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &p.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetCodec implements the CodecClassification interface for type PNGImage. +func (p *PNGImage) GetCodec() *Codec { + return &Codec{ + ODataType: p.ODataType, + Label: p.Label, + } +} + +// GetImage implements the ImageClassification interface for type PNGImage. +func (p *PNGImage) GetImage() *Image { + return &Image{ + Start: p.Start, + Step: p.Step, + Range: p.Range, + KeyFrameInterval: p.KeyFrameInterval, + StretchMode: p.StretchMode, + SyncMode: p.SyncMode, + ODataType: p.ODataType, + Label: p.Label, + } +} + +// GetVideo implements the VideoClassification interface for type PNGImage. +func (p *PNGImage) GetVideo() *Video { + return &Video{ + KeyFrameInterval: p.KeyFrameInterval, + StretchMode: p.StretchMode, + SyncMode: p.SyncMode, + ODataType: p.ODataType, + Label: p.Label, + } +} + +// MarshalJSON implements the json.Marshaller interface for type PNGImage. +func (p PNGImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyFrameInterval", p.KeyFrameInterval) + populate(objectMap, "label", p.Label) + populate(objectMap, "layers", p.Layers) + objectMap["@odata.type"] = "#Microsoft.Media.PngImage" + populate(objectMap, "range", p.Range) + populate(objectMap, "start", p.Start) + populate(objectMap, "step", p.Step) + populate(objectMap, "stretchMode", p.StretchMode) + populate(objectMap, "syncMode", p.SyncMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PNGImage. +func (p *PNGImage) 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 "keyFrameInterval": + err = unpopulate(val, &p.KeyFrameInterval) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &p.Label) + delete(rawMsg, key) + case "layers": + err = unpopulate(val, &p.Layers) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &p.ODataType) + delete(rawMsg, key) + case "range": + err = unpopulate(val, &p.Range) + delete(rawMsg, key) + case "start": + err = unpopulate(val, &p.Start) + delete(rawMsg, key) + case "step": + err = unpopulate(val, &p.Step) + delete(rawMsg, key) + case "stretchMode": + err = unpopulate(val, &p.StretchMode) + delete(rawMsg, key) + case "syncMode": + err = unpopulate(val, &p.SyncMode) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetPreset implements the PresetClassification interface for type Preset. +func (p *Preset) GetPreset() *Preset { return p } + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// GetAudioTrackDescriptor implements the AudioTrackDescriptorClassification interface for type SelectAudioTrackByAttribute. +func (s *SelectAudioTrackByAttribute) GetAudioTrackDescriptor() *AudioTrackDescriptor { + return &AudioTrackDescriptor{ + ChannelMapping: s.ChannelMapping, + ODataType: s.ODataType, + } +} + +// GetTrackDescriptor implements the TrackDescriptorClassification interface for type SelectAudioTrackByAttribute. +func (s *SelectAudioTrackByAttribute) GetTrackDescriptor() *TrackDescriptor { + return &TrackDescriptor{ + ODataType: s.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type SelectAudioTrackByAttribute. +func (s SelectAudioTrackByAttribute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "attribute", s.Attribute) + populate(objectMap, "channelMapping", s.ChannelMapping) + populate(objectMap, "filter", s.Filter) + populate(objectMap, "filterValue", s.FilterValue) + objectMap["@odata.type"] = "#Microsoft.Media.SelectAudioTrackByAttribute" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SelectAudioTrackByAttribute. +func (s *SelectAudioTrackByAttribute) 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 "attribute": + err = unpopulate(val, &s.Attribute) + delete(rawMsg, key) + case "channelMapping": + err = unpopulate(val, &s.ChannelMapping) + delete(rawMsg, key) + case "filter": + err = unpopulate(val, &s.Filter) + delete(rawMsg, key) + case "filterValue": + err = unpopulate(val, &s.FilterValue) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &s.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetAudioTrackDescriptor implements the AudioTrackDescriptorClassification interface for type SelectAudioTrackByID. +func (s *SelectAudioTrackByID) GetAudioTrackDescriptor() *AudioTrackDescriptor { + return &AudioTrackDescriptor{ + ChannelMapping: s.ChannelMapping, + ODataType: s.ODataType, + } +} + +// GetTrackDescriptor implements the TrackDescriptorClassification interface for type SelectAudioTrackByID. +func (s *SelectAudioTrackByID) GetTrackDescriptor() *TrackDescriptor { + return &TrackDescriptor{ + ODataType: s.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type SelectAudioTrackByID. +func (s SelectAudioTrackByID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "channelMapping", s.ChannelMapping) + objectMap["@odata.type"] = "#Microsoft.Media.SelectAudioTrackById" + populate(objectMap, "trackId", s.TrackID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SelectAudioTrackByID. +func (s *SelectAudioTrackByID) 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 "channelMapping": + err = unpopulate(val, &s.ChannelMapping) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &s.ODataType) + delete(rawMsg, key) + case "trackId": + err = unpopulate(val, &s.TrackID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetTrackDescriptor implements the TrackDescriptorClassification interface for type SelectVideoTrackByAttribute. +func (s *SelectVideoTrackByAttribute) GetTrackDescriptor() *TrackDescriptor { + return &TrackDescriptor{ + ODataType: s.ODataType, + } +} + +// GetVideoTrackDescriptor implements the VideoTrackDescriptorClassification interface for type SelectVideoTrackByAttribute. +func (s *SelectVideoTrackByAttribute) GetVideoTrackDescriptor() *VideoTrackDescriptor { + return &VideoTrackDescriptor{ + ODataType: s.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type SelectVideoTrackByAttribute. +func (s SelectVideoTrackByAttribute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "attribute", s.Attribute) + populate(objectMap, "filter", s.Filter) + populate(objectMap, "filterValue", s.FilterValue) + objectMap["@odata.type"] = "#Microsoft.Media.SelectVideoTrackByAttribute" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SelectVideoTrackByAttribute. +func (s *SelectVideoTrackByAttribute) 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 "attribute": + err = unpopulate(val, &s.Attribute) + delete(rawMsg, key) + case "filter": + err = unpopulate(val, &s.Filter) + delete(rawMsg, key) + case "filterValue": + err = unpopulate(val, &s.FilterValue) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &s.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetTrackDescriptor implements the TrackDescriptorClassification interface for type SelectVideoTrackByID. +func (s *SelectVideoTrackByID) GetTrackDescriptor() *TrackDescriptor { + return &TrackDescriptor{ + ODataType: s.ODataType, + } +} + +// GetVideoTrackDescriptor implements the VideoTrackDescriptorClassification interface for type SelectVideoTrackByID. +func (s *SelectVideoTrackByID) GetVideoTrackDescriptor() *VideoTrackDescriptor { + return &VideoTrackDescriptor{ + ODataType: s.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type SelectVideoTrackByID. +func (s SelectVideoTrackByID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = "#Microsoft.Media.SelectVideoTrackById" + populate(objectMap, "trackId", s.TrackID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SelectVideoTrackByID. +func (s *SelectVideoTrackByID) 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 "@odata.type": + err = unpopulate(val, &s.ODataType) + delete(rawMsg, key) + case "trackId": + err = unpopulate(val, &s.TrackID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. +func (s ServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logSpecifications", s.LogSpecifications) + populate(objectMap, "metricSpecifications", s.MetricSpecifications) + return json.Marshal(objectMap) +} + +// GetPreset implements the PresetClassification interface for type StandardEncoderPreset. +func (s *StandardEncoderPreset) GetPreset() *Preset { + return &Preset{ + ODataType: s.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type StandardEncoderPreset. +func (s StandardEncoderPreset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "codecs", s.Codecs) + populate(objectMap, "filters", s.Filters) + populate(objectMap, "formats", s.Formats) + objectMap["@odata.type"] = "#Microsoft.Media.StandardEncoderPreset" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandardEncoderPreset. +func (s *StandardEncoderPreset) 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 "codecs": + s.Codecs, err = unmarshalCodecClassificationArray(val) + delete(rawMsg, key) + case "filters": + err = unpopulate(val, &s.Filters) + delete(rawMsg, key) + case "formats": + s.Formats, err = unmarshalFormatClassificationArray(val) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &s.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageEncryptedAssetDecryptionData. +func (s StorageEncryptedAssetDecryptionData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assetFileEncryptionMetadata", s.AssetFileEncryptionMetadata) + populateByteArray(objectMap, "key", s.Key, runtime.Base64StdFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageEncryptedAssetDecryptionData. +func (s *StorageEncryptedAssetDecryptionData) 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 "assetFileEncryptionMetadata": + err = unpopulate(val, &s.AssetFileEncryptionMetadata) + delete(rawMsg, key) + case "key": + err = runtime.DecodeByteArray(string(val), &s.Key, runtime.Base64StdFormat) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingEndpoint. +func (s StreamingEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingEndpointListResult. +func (s StreamingEndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.count", s.ODataCount) + populate(objectMap, "@odata.nextLink", s.ODataNextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingEndpointProperties. +func (s StreamingEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessControl", s.AccessControl) + populate(objectMap, "availabilitySetName", s.AvailabilitySetName) + populate(objectMap, "cdnEnabled", s.CdnEnabled) + populate(objectMap, "cdnProfile", s.CdnProfile) + populate(objectMap, "cdnProvider", s.CdnProvider) + populateTimeRFC3339(objectMap, "created", s.Created) + populate(objectMap, "crossSiteAccessPolicies", s.CrossSiteAccessPolicies) + populate(objectMap, "customHostNames", s.CustomHostNames) + populate(objectMap, "description", s.Description) + populateTimeRFC3339(objectMap, "freeTrialEndTime", s.FreeTrialEndTime) + populate(objectMap, "hostName", s.HostName) + populateTimeRFC3339(objectMap, "lastModified", s.LastModified) + populate(objectMap, "maxCacheAge", s.MaxCacheAge) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "resourceState", s.ResourceState) + populate(objectMap, "scaleUnits", s.ScaleUnits) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StreamingEndpointProperties. +func (s *StreamingEndpointProperties) 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 "accessControl": + err = unpopulate(val, &s.AccessControl) + delete(rawMsg, key) + case "availabilitySetName": + err = unpopulate(val, &s.AvailabilitySetName) + delete(rawMsg, key) + case "cdnEnabled": + err = unpopulate(val, &s.CdnEnabled) + delete(rawMsg, key) + case "cdnProfile": + err = unpopulate(val, &s.CdnProfile) + delete(rawMsg, key) + case "cdnProvider": + err = unpopulate(val, &s.CdnProvider) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC3339(val, &s.Created) + delete(rawMsg, key) + case "crossSiteAccessPolicies": + err = unpopulate(val, &s.CrossSiteAccessPolicies) + delete(rawMsg, key) + case "customHostNames": + err = unpopulate(val, &s.CustomHostNames) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &s.Description) + delete(rawMsg, key) + case "freeTrialEndTime": + err = unpopulateTimeRFC3339(val, &s.FreeTrialEndTime) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, &s.HostName) + delete(rawMsg, key) + case "lastModified": + err = unpopulateTimeRFC3339(val, &s.LastModified) + delete(rawMsg, key) + case "maxCacheAge": + err = unpopulate(val, &s.MaxCacheAge) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &s.ProvisioningState) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, &s.ResourceState) + delete(rawMsg, key) + case "scaleUnits": + err = unpopulate(val, &s.ScaleUnits) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingEndpointSKUInfoListResult. +func (s StreamingEndpointSKUInfoListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingLocatorCollection. +func (s StreamingLocatorCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", s.ODataNextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingLocatorContentKey. +func (s StreamingLocatorContentKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "labelReferenceInStreamingPolicy", s.LabelReferenceInStreamingPolicy) + populate(objectMap, "policyName", s.PolicyName) + populate(objectMap, "tracks", s.Tracks) + populate(objectMap, "type", s.Type) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingLocatorProperties. +func (s StreamingLocatorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alternativeMediaId", s.AlternativeMediaID) + populate(objectMap, "assetName", s.AssetName) + populate(objectMap, "contentKeys", s.ContentKeys) + populateTimeRFC3339(objectMap, "created", s.Created) + populate(objectMap, "defaultContentKeyPolicyName", s.DefaultContentKeyPolicyName) + populateTimeRFC3339(objectMap, "endTime", s.EndTime) + populate(objectMap, "filters", s.Filters) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) + populate(objectMap, "streamingLocatorId", s.StreamingLocatorID) + populate(objectMap, "streamingPolicyName", s.StreamingPolicyName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StreamingLocatorProperties. +func (s *StreamingLocatorProperties) 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 "alternativeMediaId": + err = unpopulate(val, &s.AlternativeMediaID) + delete(rawMsg, key) + case "assetName": + err = unpopulate(val, &s.AssetName) + delete(rawMsg, key) + case "contentKeys": + err = unpopulate(val, &s.ContentKeys) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC3339(val, &s.Created) + delete(rawMsg, key) + case "defaultContentKeyPolicyName": + err = unpopulate(val, &s.DefaultContentKeyPolicyName) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, &s.EndTime) + delete(rawMsg, key) + case "filters": + err = unpopulate(val, &s.Filters) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &s.StartTime) + delete(rawMsg, key) + case "streamingLocatorId": + err = unpopulate(val, &s.StreamingLocatorID) + delete(rawMsg, key) + case "streamingPolicyName": + err = unpopulate(val, &s.StreamingPolicyName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingPath. +func (s StreamingPath) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encryptionScheme", s.EncryptionScheme) + populate(objectMap, "paths", s.Paths) + populate(objectMap, "streamingProtocol", s.StreamingProtocol) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingPolicyCollection. +func (s StreamingPolicyCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", s.ODataNextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingPolicyContentKey. +func (s StreamingPolicyContentKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "label", s.Label) + populate(objectMap, "policyName", s.PolicyName) + populate(objectMap, "tracks", s.Tracks) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingPolicyContentKeys. +func (s StreamingPolicyContentKeys) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultKey", s.DefaultKey) + populate(objectMap, "keyToTrackMappings", s.KeyToTrackMappings) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingPolicyProperties. +func (s StreamingPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "commonEncryptionCbcs", s.CommonEncryptionCbcs) + populate(objectMap, "commonEncryptionCenc", s.CommonEncryptionCenc) + populateTimeRFC3339(objectMap, "created", s.Created) + populate(objectMap, "defaultContentKeyPolicyName", s.DefaultContentKeyPolicyName) + populate(objectMap, "envelopeEncryption", s.EnvelopeEncryption) + populate(objectMap, "noEncryption", s.NoEncryption) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StreamingPolicyProperties. +func (s *StreamingPolicyProperties) 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 "commonEncryptionCbcs": + err = unpopulate(val, &s.CommonEncryptionCbcs) + delete(rawMsg, key) + case "commonEncryptionCenc": + err = unpopulate(val, &s.CommonEncryptionCenc) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC3339(val, &s.Created) + delete(rawMsg, key) + case "defaultContentKeyPolicyName": + err = unpopulate(val, &s.DefaultContentKeyPolicyName) + delete(rawMsg, key) + case "envelopeEncryption": + err = unpopulate(val, &s.EnvelopeEncryption) + delete(rawMsg, key) + case "noEncryption": + err = unpopulate(val, &s.NoEncryption) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// 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 +} + +// GetTrackBase implements the TrackBaseClassification interface for type TextTrack. +func (t *TextTrack) GetTrackBase() *TrackBase { + return &TrackBase{ + ODataType: t.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type TextTrack. +func (t TextTrack) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", t.DisplayName) + populate(objectMap, "fileName", t.FileName) + populate(objectMap, "hlsSettings", t.HlsSettings) + populate(objectMap, "languageCode", t.LanguageCode) + objectMap["@odata.type"] = "#Microsoft.Media.TextTrack" + populate(objectMap, "playerVisibility", t.PlayerVisibility) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TextTrack. +func (t *TextTrack) 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 "displayName": + err = unpopulate(val, &t.DisplayName) + delete(rawMsg, key) + case "fileName": + err = unpopulate(val, &t.FileName) + delete(rawMsg, key) + case "hlsSettings": + err = unpopulate(val, &t.HlsSettings) + delete(rawMsg, key) + case "languageCode": + err = unpopulate(val, &t.LanguageCode) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &t.ODataType) + delete(rawMsg, key) + case "playerVisibility": + err = unpopulate(val, &t.PlayerVisibility) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetTrackBase implements the TrackBaseClassification interface for type TrackBase. +func (t *TrackBase) GetTrackBase() *TrackBase { return t } + +// GetTrackDescriptor implements the TrackDescriptorClassification interface for type TrackDescriptor. +func (t *TrackDescriptor) GetTrackDescriptor() *TrackDescriptor { return t } + +// MarshalJSON implements the json.Marshaller interface for type TrackSelection. +func (t TrackSelection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "trackSelections", t.TrackSelections) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Transform. +func (t Transform) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type TransformCollection. +func (t TransformCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", t.ODataNextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type TransformOutput. +func (t TransformOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "onError", t.OnError) + populate(objectMap, "preset", t.Preset) + populate(objectMap, "relativePriority", t.RelativePriority) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TransformOutput. +func (t *TransformOutput) 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 "onError": + err = unpopulate(val, &t.OnError) + delete(rawMsg, key) + case "preset": + t.Preset, err = unmarshalPresetClassification(val) + delete(rawMsg, key) + case "relativePriority": + err = unpopulate(val, &t.RelativePriority) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TransformProperties. +func (t TransformProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "created", t.Created) + populate(objectMap, "description", t.Description) + populateTimeRFC3339(objectMap, "lastModified", t.LastModified) + populate(objectMap, "outputs", t.Outputs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TransformProperties. +func (t *TransformProperties) 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 "created": + err = unpopulateTimeRFC3339(val, &t.Created) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &t.Description) + delete(rawMsg, key) + case "lastModified": + err = unpopulateTimeRFC3339(val, &t.LastModified) + delete(rawMsg, key) + case "outputs": + err = unpopulate(val, &t.Outputs) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetFormat implements the FormatClassification interface for type TransportStreamFormat. +func (t *TransportStreamFormat) GetFormat() *Format { + return &Format{ + ODataType: t.ODataType, + FilenamePattern: t.FilenamePattern, + } +} + +// GetMultiBitrateFormat implements the MultiBitrateFormatClassification interface for type TransportStreamFormat. +func (t *TransportStreamFormat) GetMultiBitrateFormat() *MultiBitrateFormat { + return &MultiBitrateFormat{ + OutputFiles: t.OutputFiles, + ODataType: t.ODataType, + FilenamePattern: t.FilenamePattern, + } +} + +// MarshalJSON implements the json.Marshaller interface for type TransportStreamFormat. +func (t TransportStreamFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filenamePattern", t.FilenamePattern) + objectMap["@odata.type"] = "#Microsoft.Media.TransportStreamFormat" + populate(objectMap, "outputFiles", t.OutputFiles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TransportStreamFormat. +func (t *TransportStreamFormat) 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 "filenamePattern": + err = unpopulate(val, &t.FilenamePattern) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &t.ODataType) + delete(rawMsg, key) + case "outputFiles": + err = unpopulate(val, &t.OutputFiles) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetClipTime implements the ClipTimeClassification interface for type UTCClipTime. +func (u *UTCClipTime) GetClipTime() *ClipTime { + return &ClipTime{ + ODataType: u.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type UTCClipTime. +func (u UTCClipTime) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = "#Microsoft.Media.UtcClipTime" + populateTimeRFC3339(objectMap, "time", u.Time) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UTCClipTime. +func (u *UTCClipTime) 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 "@odata.type": + err = unpopulate(val, &u.ODataType) + delete(rawMsg, key) + case "time": + err = unpopulateTimeRFC3339(val, &u.Time) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetCodec implements the CodecClassification interface for type Video. +func (v *Video) GetCodec() *Codec { + return &Codec{ + ODataType: v.ODataType, + Label: v.Label, + } +} + +// GetVideo implements the VideoClassification interface for type Video. +func (v *Video) GetVideo() *Video { return v } + +// MarshalJSON implements the json.Marshaller interface for type Video. +func (v Video) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyFrameInterval", v.KeyFrameInterval) + populate(objectMap, "label", v.Label) + objectMap["@odata.type"] = "#Microsoft.Media.Video" + populate(objectMap, "stretchMode", v.StretchMode) + populate(objectMap, "syncMode", v.SyncMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Video. +func (v *Video) 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 "keyFrameInterval": + err = unpopulate(val, &v.KeyFrameInterval) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &v.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &v.ODataType) + delete(rawMsg, key) + case "stretchMode": + err = unpopulate(val, &v.StretchMode) + delete(rawMsg, key) + case "syncMode": + err = unpopulate(val, &v.SyncMode) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetAudioAnalyzerPreset implements the AudioAnalyzerPresetClassification interface for type VideoAnalyzerPreset. +func (v *VideoAnalyzerPreset) GetAudioAnalyzerPreset() *AudioAnalyzerPreset { + return &AudioAnalyzerPreset{ + AudioLanguage: v.AudioLanguage, + Mode: v.Mode, + ExperimentalOptions: v.ExperimentalOptions, + ODataType: v.ODataType, + } +} + +// GetPreset implements the PresetClassification interface for type VideoAnalyzerPreset. +func (v *VideoAnalyzerPreset) GetPreset() *Preset { + return &Preset{ + ODataType: v.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type VideoAnalyzerPreset. +func (v VideoAnalyzerPreset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "audioLanguage", v.AudioLanguage) + populate(objectMap, "experimentalOptions", v.ExperimentalOptions) + populate(objectMap, "insightsToExtract", v.InsightsToExtract) + populate(objectMap, "mode", v.Mode) + objectMap["@odata.type"] = "#Microsoft.Media.VideoAnalyzerPreset" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoAnalyzerPreset. +func (v *VideoAnalyzerPreset) 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 "audioLanguage": + err = unpopulate(val, &v.AudioLanguage) + delete(rawMsg, key) + case "experimentalOptions": + err = unpopulate(val, &v.ExperimentalOptions) + delete(rawMsg, key) + case "insightsToExtract": + err = unpopulate(val, &v.InsightsToExtract) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, &v.Mode) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &v.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetOverlay implements the OverlayClassification interface for type VideoOverlay. +func (v *VideoOverlay) GetOverlay() *Overlay { + return &Overlay{ + ODataType: v.ODataType, + InputLabel: v.InputLabel, + Start: v.Start, + End: v.End, + FadeInDuration: v.FadeInDuration, + FadeOutDuration: v.FadeOutDuration, + AudioGainLevel: v.AudioGainLevel, + } +} + +// MarshalJSON implements the json.Marshaller interface for type VideoOverlay. +func (v VideoOverlay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "audioGainLevel", v.AudioGainLevel) + populate(objectMap, "cropRectangle", v.CropRectangle) + populate(objectMap, "end", v.End) + populate(objectMap, "fadeInDuration", v.FadeInDuration) + populate(objectMap, "fadeOutDuration", v.FadeOutDuration) + populate(objectMap, "inputLabel", v.InputLabel) + objectMap["@odata.type"] = "#Microsoft.Media.VideoOverlay" + populate(objectMap, "opacity", v.Opacity) + populate(objectMap, "position", v.Position) + populate(objectMap, "start", v.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoOverlay. +func (v *VideoOverlay) 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 "audioGainLevel": + err = unpopulate(val, &v.AudioGainLevel) + delete(rawMsg, key) + case "cropRectangle": + err = unpopulate(val, &v.CropRectangle) + delete(rawMsg, key) + case "end": + err = unpopulate(val, &v.End) + delete(rawMsg, key) + case "fadeInDuration": + err = unpopulate(val, &v.FadeInDuration) + delete(rawMsg, key) + case "fadeOutDuration": + err = unpopulate(val, &v.FadeOutDuration) + delete(rawMsg, key) + case "inputLabel": + err = unpopulate(val, &v.InputLabel) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &v.ODataType) + delete(rawMsg, key) + case "opacity": + err = unpopulate(val, &v.Opacity) + delete(rawMsg, key) + case "position": + err = unpopulate(val, &v.Position) + delete(rawMsg, key) + case "start": + err = unpopulate(val, &v.Start) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetTrackBase implements the TrackBaseClassification interface for type VideoTrack. +func (v *VideoTrack) GetTrackBase() *TrackBase { + return &TrackBase{ + ODataType: v.ODataType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type VideoTrack. +func (v VideoTrack) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = "#Microsoft.Media.VideoTrack" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoTrack. +func (v *VideoTrack) 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 "@odata.type": + err = unpopulate(val, &v.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetTrackDescriptor implements the TrackDescriptorClassification interface for type VideoTrackDescriptor. +func (v *VideoTrackDescriptor) GetTrackDescriptor() *TrackDescriptor { + return &TrackDescriptor{ + ODataType: v.ODataType, + } +} + +// GetVideoTrackDescriptor implements the VideoTrackDescriptorClassification interface for type VideoTrackDescriptor. +func (v *VideoTrackDescriptor) GetVideoTrackDescriptor() *VideoTrackDescriptor { return v } + +// MarshalJSON implements the json.Marshaller interface for type VideoTrackDescriptor. +func (v VideoTrackDescriptor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = "#Microsoft.Media.VideoTrackDescriptor" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoTrackDescriptor. +func (v *VideoTrackDescriptor) 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 "@odata.type": + err = unpopulate(val, &v.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +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 + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operationresults_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operationresults_client.go index 684fc4c15d4c..1daff4df5d27 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operationresults_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operationresults_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type OperationResultsClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationResultsClient { +func NewOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationResultsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationResultsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get asset track operation result. @@ -113,7 +118,7 @@ func (client *OperationResultsClient) getCreateRequest(ctx context.Context, reso // getHandleResponse handles the Get response. func (client *OperationResultsClient) getHandleResponse(resp *http.Response) (OperationResultsClientGetResponse, error) { - result := OperationResultsClientGetResponse{RawResponse: resp} + result := OperationResultsClientGetResponse{} if val := resp.Header.Get("Retry-After"); val != "" { retryAfter32, err := strconv.ParseInt(val, 10, 32) retryAfter := int32(retryAfter32) diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operations_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operations_client.go index dd1eeaad19c5..f2463bdbd17c 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operations_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,19 +29,23 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // List - Lists all the Media Services operations. @@ -77,7 +82,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationCollection); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operationstatuses_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operationstatuses_client.go index 44bdf45b4d74..438e917bc8e5 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operationstatuses_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operationstatuses_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type OperationStatusesClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationStatusesClient { +func NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationStatusesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get asset track operation status. @@ -112,7 +117,7 @@ func (client *OperationStatusesClient) getCreateRequest(ctx context.Context, res // getHandleResponse handles the Get response. func (client *OperationStatusesClient) getHandleResponse(resp *http.Response) (OperationStatusesClientGetResponse, error) { - result := OperationStatusesClientGetResponse{RawResponse: resp} + result := OperationStatusesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AssetTrackOperationStatus); err != nil { return OperationStatusesClientGetResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pagers.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pagers.go deleted file mode 100644 index 56bbcdfab2d1..000000000000 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pagers.go +++ /dev/null @@ -1,719 +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 armmediaservices - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// AccountFiltersClientListPager provides operations for iterating over paged responses. -type AccountFiltersClientListPager struct { - client *AccountFiltersClient - current AccountFiltersClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, AccountFiltersClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *AccountFiltersClientListPager) 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 *AccountFiltersClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.AccountFilterCollection.ODataNextLink == nil || len(*p.current.AccountFilterCollection.ODataNextLink) == 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 = runtime.NewResponseError(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 AccountFiltersClientListResponse page. -func (p *AccountFiltersClientListPager) PageResponse() AccountFiltersClientListResponse { - return p.current -} - -// AssetFiltersClientListPager provides operations for iterating over paged responses. -type AssetFiltersClientListPager struct { - client *AssetFiltersClient - current AssetFiltersClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, AssetFiltersClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *AssetFiltersClientListPager) 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 *AssetFiltersClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.AssetFilterCollection.ODataNextLink == nil || len(*p.current.AssetFilterCollection.ODataNextLink) == 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 = runtime.NewResponseError(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 AssetFiltersClientListResponse page. -func (p *AssetFiltersClientListPager) PageResponse() AssetFiltersClientListResponse { - return p.current -} - -// AssetsClientListPager provides operations for iterating over paged responses. -type AssetsClientListPager struct { - client *AssetsClient - current AssetsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, AssetsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *AssetsClientListPager) 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 *AssetsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.AssetCollection.ODataNextLink == nil || len(*p.current.AssetCollection.ODataNextLink) == 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 = runtime.NewResponseError(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 AssetsClientListResponse page. -func (p *AssetsClientListPager) PageResponse() AssetsClientListResponse { - return p.current -} - -// ClientListBySubscriptionPager provides operations for iterating over paged responses. -type ClientListBySubscriptionPager struct { - client *Client - current ClientListBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ClientListBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ClientListBySubscriptionPager) 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 *ClientListBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.MediaServiceCollection.ODataNextLink == nil || len(*p.current.MediaServiceCollection.ODataNextLink) == 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 = runtime.NewResponseError(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 ClientListBySubscriptionResponse page. -func (p *ClientListBySubscriptionPager) PageResponse() ClientListBySubscriptionResponse { - return p.current -} - -// ClientListPager provides operations for iterating over paged responses. -type ClientListPager struct { - client *Client - current ClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ClientListPager) 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 *ClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.MediaServiceCollection.ODataNextLink == nil || len(*p.current.MediaServiceCollection.ODataNextLink) == 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 = runtime.NewResponseError(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 ClientListResponse page. -func (p *ClientListPager) PageResponse() ClientListResponse { - return p.current -} - -// ContentKeyPoliciesClientListPager provides operations for iterating over paged responses. -type ContentKeyPoliciesClientListPager struct { - client *ContentKeyPoliciesClient - current ContentKeyPoliciesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ContentKeyPoliciesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ContentKeyPoliciesClientListPager) 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 *ContentKeyPoliciesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ContentKeyPolicyCollection.ODataNextLink == nil || len(*p.current.ContentKeyPolicyCollection.ODataNextLink) == 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 = runtime.NewResponseError(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 ContentKeyPoliciesClientListResponse page. -func (p *ContentKeyPoliciesClientListPager) PageResponse() ContentKeyPoliciesClientListResponse { - return p.current -} - -// JobsClientListPager provides operations for iterating over paged responses. -type JobsClientListPager struct { - client *JobsClient - current JobsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, JobsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *JobsClientListPager) 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 *JobsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.JobCollection.ODataNextLink == nil || len(*p.current.JobCollection.ODataNextLink) == 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 = runtime.NewResponseError(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 JobsClientListResponse page. -func (p *JobsClientListPager) PageResponse() JobsClientListResponse { - return p.current -} - -// LiveEventsClientListPager provides operations for iterating over paged responses. -type LiveEventsClientListPager struct { - client *LiveEventsClient - current LiveEventsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, LiveEventsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *LiveEventsClientListPager) 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 *LiveEventsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.LiveEventListResult.ODataNextLink == nil || len(*p.current.LiveEventListResult.ODataNextLink) == 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 = runtime.NewResponseError(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 LiveEventsClientListResponse page. -func (p *LiveEventsClientListPager) PageResponse() LiveEventsClientListResponse { - return p.current -} - -// LiveOutputsClientListPager provides operations for iterating over paged responses. -type LiveOutputsClientListPager struct { - client *LiveOutputsClient - current LiveOutputsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, LiveOutputsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *LiveOutputsClientListPager) 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 *LiveOutputsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.LiveOutputListResult.ODataNextLink == nil || len(*p.current.LiveOutputListResult.ODataNextLink) == 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 = runtime.NewResponseError(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 LiveOutputsClientListResponse page. -func (p *LiveOutputsClientListPager) PageResponse() LiveOutputsClientListResponse { - return p.current -} - -// StreamingEndpointsClientListPager provides operations for iterating over paged responses. -type StreamingEndpointsClientListPager struct { - client *StreamingEndpointsClient - current StreamingEndpointsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, StreamingEndpointsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *StreamingEndpointsClientListPager) 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 *StreamingEndpointsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.StreamingEndpointListResult.ODataNextLink == nil || len(*p.current.StreamingEndpointListResult.ODataNextLink) == 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 = runtime.NewResponseError(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 StreamingEndpointsClientListResponse page. -func (p *StreamingEndpointsClientListPager) PageResponse() StreamingEndpointsClientListResponse { - return p.current -} - -// StreamingLocatorsClientListPager provides operations for iterating over paged responses. -type StreamingLocatorsClientListPager struct { - client *StreamingLocatorsClient - current StreamingLocatorsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, StreamingLocatorsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *StreamingLocatorsClientListPager) 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 *StreamingLocatorsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.StreamingLocatorCollection.ODataNextLink == nil || len(*p.current.StreamingLocatorCollection.ODataNextLink) == 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 = runtime.NewResponseError(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 StreamingLocatorsClientListResponse page. -func (p *StreamingLocatorsClientListPager) PageResponse() StreamingLocatorsClientListResponse { - return p.current -} - -// StreamingPoliciesClientListPager provides operations for iterating over paged responses. -type StreamingPoliciesClientListPager struct { - client *StreamingPoliciesClient - current StreamingPoliciesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, StreamingPoliciesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *StreamingPoliciesClientListPager) 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 *StreamingPoliciesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.StreamingPolicyCollection.ODataNextLink == nil || len(*p.current.StreamingPolicyCollection.ODataNextLink) == 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 = runtime.NewResponseError(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 StreamingPoliciesClientListResponse page. -func (p *StreamingPoliciesClientListPager) PageResponse() StreamingPoliciesClientListResponse { - return p.current -} - -// TransformsClientListPager provides operations for iterating over paged responses. -type TransformsClientListPager struct { - client *TransformsClient - current TransformsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, TransformsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *TransformsClientListPager) 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 *TransformsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.TransformCollection.ODataNextLink == nil || len(*p.current.TransformCollection.ODataNextLink) == 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 = runtime.NewResponseError(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 TransformsClientListResponse page. -func (p *TransformsClientListPager) PageResponse() TransformsClientListResponse { - return p.current -} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pollers.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pollers.go deleted file mode 100644 index 141a2db1ed19..000000000000 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pollers.go +++ /dev/null @@ -1,832 +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 armmediaservices - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// LiveEventsClientAllocatePoller provides polling facilities until the operation reaches a terminal state. -type LiveEventsClientAllocatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *LiveEventsClientAllocatePoller) 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 *LiveEventsClientAllocatePoller) 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 LiveEventsClientAllocateResponse will be returned. -func (p *LiveEventsClientAllocatePoller) FinalResponse(ctx context.Context) (LiveEventsClientAllocateResponse, error) { - respType := LiveEventsClientAllocateResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return LiveEventsClientAllocateResponse{}, 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 *LiveEventsClientAllocatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// LiveEventsClientCreatePoller provides polling facilities until the operation reaches a terminal state. -type LiveEventsClientCreatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *LiveEventsClientCreatePoller) 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 *LiveEventsClientCreatePoller) 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 LiveEventsClientCreateResponse will be returned. -func (p *LiveEventsClientCreatePoller) FinalResponse(ctx context.Context) (LiveEventsClientCreateResponse, error) { - respType := LiveEventsClientCreateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.LiveEvent) - if err != nil { - return LiveEventsClientCreateResponse{}, 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 *LiveEventsClientCreatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// LiveEventsClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type LiveEventsClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *LiveEventsClientDeletePoller) 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 *LiveEventsClientDeletePoller) 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 LiveEventsClientDeleteResponse will be returned. -func (p *LiveEventsClientDeletePoller) FinalResponse(ctx context.Context) (LiveEventsClientDeleteResponse, error) { - respType := LiveEventsClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return LiveEventsClientDeleteResponse{}, 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 *LiveEventsClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// LiveEventsClientResetPoller provides polling facilities until the operation reaches a terminal state. -type LiveEventsClientResetPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *LiveEventsClientResetPoller) 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 *LiveEventsClientResetPoller) 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 LiveEventsClientResetResponse will be returned. -func (p *LiveEventsClientResetPoller) FinalResponse(ctx context.Context) (LiveEventsClientResetResponse, error) { - respType := LiveEventsClientResetResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return LiveEventsClientResetResponse{}, 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 *LiveEventsClientResetPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// LiveEventsClientStartPoller provides polling facilities until the operation reaches a terminal state. -type LiveEventsClientStartPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *LiveEventsClientStartPoller) 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 *LiveEventsClientStartPoller) 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 LiveEventsClientStartResponse will be returned. -func (p *LiveEventsClientStartPoller) FinalResponse(ctx context.Context) (LiveEventsClientStartResponse, error) { - respType := LiveEventsClientStartResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return LiveEventsClientStartResponse{}, 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 *LiveEventsClientStartPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// LiveEventsClientStopPoller provides polling facilities until the operation reaches a terminal state. -type LiveEventsClientStopPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *LiveEventsClientStopPoller) 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 *LiveEventsClientStopPoller) 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 LiveEventsClientStopResponse will be returned. -func (p *LiveEventsClientStopPoller) FinalResponse(ctx context.Context) (LiveEventsClientStopResponse, error) { - respType := LiveEventsClientStopResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return LiveEventsClientStopResponse{}, 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 *LiveEventsClientStopPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// LiveEventsClientUpdatePoller provides polling facilities until the operation reaches a terminal state. -type LiveEventsClientUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *LiveEventsClientUpdatePoller) 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 *LiveEventsClientUpdatePoller) 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 LiveEventsClientUpdateResponse will be returned. -func (p *LiveEventsClientUpdatePoller) FinalResponse(ctx context.Context) (LiveEventsClientUpdateResponse, error) { - respType := LiveEventsClientUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.LiveEvent) - if err != nil { - return LiveEventsClientUpdateResponse{}, 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 *LiveEventsClientUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// LiveOutputsClientCreatePoller provides polling facilities until the operation reaches a terminal state. -type LiveOutputsClientCreatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *LiveOutputsClientCreatePoller) 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 *LiveOutputsClientCreatePoller) 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 LiveOutputsClientCreateResponse will be returned. -func (p *LiveOutputsClientCreatePoller) FinalResponse(ctx context.Context) (LiveOutputsClientCreateResponse, error) { - respType := LiveOutputsClientCreateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.LiveOutput) - if err != nil { - return LiveOutputsClientCreateResponse{}, 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 *LiveOutputsClientCreatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// LiveOutputsClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type LiveOutputsClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *LiveOutputsClientDeletePoller) 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 *LiveOutputsClientDeletePoller) 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 LiveOutputsClientDeleteResponse will be returned. -func (p *LiveOutputsClientDeletePoller) FinalResponse(ctx context.Context) (LiveOutputsClientDeleteResponse, error) { - respType := LiveOutputsClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return LiveOutputsClientDeleteResponse{}, 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 *LiveOutputsClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// StreamingEndpointsClientCreatePoller provides polling facilities until the operation reaches a terminal state. -type StreamingEndpointsClientCreatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *StreamingEndpointsClientCreatePoller) 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 *StreamingEndpointsClientCreatePoller) 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 StreamingEndpointsClientCreateResponse will be returned. -func (p *StreamingEndpointsClientCreatePoller) FinalResponse(ctx context.Context) (StreamingEndpointsClientCreateResponse, error) { - respType := StreamingEndpointsClientCreateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.StreamingEndpoint) - if err != nil { - return StreamingEndpointsClientCreateResponse{}, 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 *StreamingEndpointsClientCreatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// StreamingEndpointsClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type StreamingEndpointsClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *StreamingEndpointsClientDeletePoller) 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 *StreamingEndpointsClientDeletePoller) 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 StreamingEndpointsClientDeleteResponse will be returned. -func (p *StreamingEndpointsClientDeletePoller) FinalResponse(ctx context.Context) (StreamingEndpointsClientDeleteResponse, error) { - respType := StreamingEndpointsClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return StreamingEndpointsClientDeleteResponse{}, 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 *StreamingEndpointsClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// StreamingEndpointsClientScalePoller provides polling facilities until the operation reaches a terminal state. -type StreamingEndpointsClientScalePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *StreamingEndpointsClientScalePoller) 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 *StreamingEndpointsClientScalePoller) 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 StreamingEndpointsClientScaleResponse will be returned. -func (p *StreamingEndpointsClientScalePoller) FinalResponse(ctx context.Context) (StreamingEndpointsClientScaleResponse, error) { - respType := StreamingEndpointsClientScaleResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return StreamingEndpointsClientScaleResponse{}, 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 *StreamingEndpointsClientScalePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// StreamingEndpointsClientStartPoller provides polling facilities until the operation reaches a terminal state. -type StreamingEndpointsClientStartPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *StreamingEndpointsClientStartPoller) 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 *StreamingEndpointsClientStartPoller) 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 StreamingEndpointsClientStartResponse will be returned. -func (p *StreamingEndpointsClientStartPoller) FinalResponse(ctx context.Context) (StreamingEndpointsClientStartResponse, error) { - respType := StreamingEndpointsClientStartResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return StreamingEndpointsClientStartResponse{}, 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 *StreamingEndpointsClientStartPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// StreamingEndpointsClientStopPoller provides polling facilities until the operation reaches a terminal state. -type StreamingEndpointsClientStopPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *StreamingEndpointsClientStopPoller) 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 *StreamingEndpointsClientStopPoller) 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 StreamingEndpointsClientStopResponse will be returned. -func (p *StreamingEndpointsClientStopPoller) FinalResponse(ctx context.Context) (StreamingEndpointsClientStopResponse, error) { - respType := StreamingEndpointsClientStopResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return StreamingEndpointsClientStopResponse{}, 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 *StreamingEndpointsClientStopPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// StreamingEndpointsClientUpdatePoller provides polling facilities until the operation reaches a terminal state. -type StreamingEndpointsClientUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *StreamingEndpointsClientUpdatePoller) 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 *StreamingEndpointsClientUpdatePoller) 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 StreamingEndpointsClientUpdateResponse will be returned. -func (p *StreamingEndpointsClientUpdatePoller) FinalResponse(ctx context.Context) (StreamingEndpointsClientUpdateResponse, error) { - respType := StreamingEndpointsClientUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.StreamingEndpoint) - if err != nil { - return StreamingEndpointsClientUpdateResponse{}, 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 *StreamingEndpointsClientUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// TracksClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type TracksClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *TracksClientCreateOrUpdatePoller) 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 *TracksClientCreateOrUpdatePoller) 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 TracksClientCreateOrUpdateResponse will be returned. -func (p *TracksClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (TracksClientCreateOrUpdateResponse, error) { - respType := TracksClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.AssetTrack) - if err != nil { - return TracksClientCreateOrUpdateResponse{}, 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 *TracksClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// TracksClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type TracksClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *TracksClientDeletePoller) 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 *TracksClientDeletePoller) 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 TracksClientDeleteResponse will be returned. -func (p *TracksClientDeletePoller) FinalResponse(ctx context.Context) (TracksClientDeleteResponse, error) { - respType := TracksClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return TracksClientDeleteResponse{}, 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 *TracksClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// TracksClientUpdatePoller provides polling facilities until the operation reaches a terminal state. -type TracksClientUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *TracksClientUpdatePoller) 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 *TracksClientUpdatePoller) 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 TracksClientUpdateResponse will be returned. -func (p *TracksClientUpdatePoller) FinalResponse(ctx context.Context) (TracksClientUpdateResponse, error) { - respType := TracksClientUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.AssetTrack) - if err != nil { - return TracksClientUpdateResponse{}, 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 *TracksClientUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// TracksClientUpdateTrackDataPoller provides polling facilities until the operation reaches a terminal state. -type TracksClientUpdateTrackDataPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *TracksClientUpdateTrackDataPoller) 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 *TracksClientUpdateTrackDataPoller) 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 TracksClientUpdateTrackDataResponse will be returned. -func (p *TracksClientUpdateTrackDataPoller) FinalResponse(ctx context.Context) (TracksClientUpdateTrackDataResponse, error) { - respType := TracksClientUpdateTrackDataResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return TracksClientUpdateTrackDataResponse{}, 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 *TracksClientUpdateTrackDataPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_polymorphic_helpers.go index fb765c4179b3..b145239f144c 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_polymorphic_helpers.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privateendpointconnections_client.go index 43000b9b0a04..9c888d93e7a0 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privateendpointconnections_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type PrivateEndpointConnectionsClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateEndpointConnectionsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Update private endpoint connection. @@ -103,7 +108,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *PrivateEndpointConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error) { - result := PrivateEndpointConnectionsClientCreateOrUpdateResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { return PrivateEndpointConnectionsClientCreateOrUpdateResponse{}, err } @@ -128,7 +133,7 @@ func (client *PrivateEndpointConnectionsClient) Delete(ctx context.Context, reso if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return PrivateEndpointConnectionsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return PrivateEndpointConnectionsClientDeleteResponse{RawResponse: resp}, nil + return PrivateEndpointConnectionsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -214,7 +219,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con // getHandleResponse handles the Get response. func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { - result := PrivateEndpointConnectionsClientGetResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } @@ -270,7 +275,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co // listHandleResponse handles the List response. func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListResponse, error) { - result := PrivateEndpointConnectionsClientListResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { return PrivateEndpointConnectionsClientListResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privatelinkresources_client.go index a0a120f43386..70c1f6dff83c 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privatelinkresources_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type PrivateLinkResourcesClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateLinkResourcesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get group ID. @@ -102,7 +107,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, // getHandleResponse handles the Get response. func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesClientGetResponse, error) { - result := PrivateLinkResourcesClientGetResponse{RawResponse: resp} + result := PrivateLinkResourcesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { return PrivateLinkResourcesClientGetResponse{}, err } @@ -158,7 +163,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, // listHandleResponse handles the List response. func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListResponse, error) { - result := PrivateLinkResourcesClientListResponse{RawResponse: resp} + result := PrivateLinkResourcesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { return PrivateLinkResourcesClientListResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_response_types.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_response_types.go index ec194f9ac04a..c9f8f98a47d3 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_response_types.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,922 +8,268 @@ package armmediaservices -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - // AccountFiltersClientCreateOrUpdateResponse contains the response from method AccountFiltersClient.CreateOrUpdate. type AccountFiltersClientCreateOrUpdateResponse struct { - AccountFiltersClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountFiltersClientCreateOrUpdateResult contains the result from method AccountFiltersClient.CreateOrUpdate. -type AccountFiltersClientCreateOrUpdateResult struct { AccountFilter } // AccountFiltersClientDeleteResponse contains the response from method AccountFiltersClient.Delete. type AccountFiltersClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // AccountFiltersClientGetResponse contains the response from method AccountFiltersClient.Get. type AccountFiltersClientGetResponse struct { - AccountFiltersClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountFiltersClientGetResult contains the result from method AccountFiltersClient.Get. -type AccountFiltersClientGetResult struct { AccountFilter } // AccountFiltersClientListResponse contains the response from method AccountFiltersClient.List. type AccountFiltersClientListResponse struct { - AccountFiltersClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountFiltersClientListResult contains the result from method AccountFiltersClient.List. -type AccountFiltersClientListResult struct { AccountFilterCollection } // AccountFiltersClientUpdateResponse contains the response from method AccountFiltersClient.Update. type AccountFiltersClientUpdateResponse struct { - AccountFiltersClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountFiltersClientUpdateResult contains the result from method AccountFiltersClient.Update. -type AccountFiltersClientUpdateResult struct { AccountFilter } // AssetFiltersClientCreateOrUpdateResponse contains the response from method AssetFiltersClient.CreateOrUpdate. type AssetFiltersClientCreateOrUpdateResponse struct { - AssetFiltersClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AssetFiltersClientCreateOrUpdateResult contains the result from method AssetFiltersClient.CreateOrUpdate. -type AssetFiltersClientCreateOrUpdateResult struct { AssetFilter } // AssetFiltersClientDeleteResponse contains the response from method AssetFiltersClient.Delete. type AssetFiltersClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // AssetFiltersClientGetResponse contains the response from method AssetFiltersClient.Get. type AssetFiltersClientGetResponse struct { - AssetFiltersClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AssetFiltersClientGetResult contains the result from method AssetFiltersClient.Get. -type AssetFiltersClientGetResult struct { AssetFilter } // AssetFiltersClientListResponse contains the response from method AssetFiltersClient.List. type AssetFiltersClientListResponse struct { - AssetFiltersClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AssetFiltersClientListResult contains the result from method AssetFiltersClient.List. -type AssetFiltersClientListResult struct { AssetFilterCollection } // AssetFiltersClientUpdateResponse contains the response from method AssetFiltersClient.Update. type AssetFiltersClientUpdateResponse struct { - AssetFiltersClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AssetFiltersClientUpdateResult contains the result from method AssetFiltersClient.Update. -type AssetFiltersClientUpdateResult struct { AssetFilter } // AssetsClientCreateOrUpdateResponse contains the response from method AssetsClient.CreateOrUpdate. type AssetsClientCreateOrUpdateResponse struct { - AssetsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AssetsClientCreateOrUpdateResult contains the result from method AssetsClient.CreateOrUpdate. -type AssetsClientCreateOrUpdateResult struct { Asset } // AssetsClientDeleteResponse contains the response from method AssetsClient.Delete. type AssetsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // AssetsClientGetEncryptionKeyResponse contains the response from method AssetsClient.GetEncryptionKey. type AssetsClientGetEncryptionKeyResponse struct { - AssetsClientGetEncryptionKeyResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AssetsClientGetEncryptionKeyResult contains the result from method AssetsClient.GetEncryptionKey. -type AssetsClientGetEncryptionKeyResult struct { StorageEncryptedAssetDecryptionData } // AssetsClientGetResponse contains the response from method AssetsClient.Get. type AssetsClientGetResponse struct { - AssetsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AssetsClientGetResult contains the result from method AssetsClient.Get. -type AssetsClientGetResult struct { Asset } // AssetsClientListContainerSasResponse contains the response from method AssetsClient.ListContainerSas. type AssetsClientListContainerSasResponse struct { - AssetsClientListContainerSasResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AssetsClientListContainerSasResult contains the result from method AssetsClient.ListContainerSas. -type AssetsClientListContainerSasResult struct { AssetContainerSas } // AssetsClientListResponse contains the response from method AssetsClient.List. type AssetsClientListResponse struct { - AssetsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AssetsClientListResult contains the result from method AssetsClient.List. -type AssetsClientListResult struct { AssetCollection } // AssetsClientListStreamingLocatorsResponse contains the response from method AssetsClient.ListStreamingLocators. type AssetsClientListStreamingLocatorsResponse struct { - AssetsClientListStreamingLocatorsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AssetsClientListStreamingLocatorsResult contains the result from method AssetsClient.ListStreamingLocators. -type AssetsClientListStreamingLocatorsResult struct { ListStreamingLocatorsResponse } // AssetsClientUpdateResponse contains the response from method AssetsClient.Update. type AssetsClientUpdateResponse struct { - AssetsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AssetsClientUpdateResult contains the result from method AssetsClient.Update. -type AssetsClientUpdateResult struct { Asset } // ClientCreateOrUpdateResponse contains the response from method Client.CreateOrUpdate. type ClientCreateOrUpdateResponse struct { - ClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientCreateOrUpdateResult contains the result from method Client.CreateOrUpdate. -type ClientCreateOrUpdateResult struct { MediaService } // ClientDeleteResponse contains the response from method Client.Delete. type ClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // ClientGetResponse contains the response from method Client.Get. type ClientGetResponse struct { - ClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientGetResult contains the result from method Client.Get. -type ClientGetResult struct { MediaService } // ClientListBySubscriptionResponse contains the response from method Client.ListBySubscription. type ClientListBySubscriptionResponse struct { - ClientListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListBySubscriptionResult contains the result from method Client.ListBySubscription. -type ClientListBySubscriptionResult struct { MediaServiceCollection } // ClientListEdgePoliciesResponse contains the response from method Client.ListEdgePolicies. type ClientListEdgePoliciesResponse struct { - ClientListEdgePoliciesResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListEdgePoliciesResult contains the result from method Client.ListEdgePolicies. -type ClientListEdgePoliciesResult struct { EdgePolicies } // ClientListResponse contains the response from method Client.List. type ClientListResponse struct { - ClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListResult contains the result from method Client.List. -type ClientListResult struct { MediaServiceCollection } // ClientSyncStorageKeysResponse contains the response from method Client.SyncStorageKeys. type ClientSyncStorageKeysResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // ClientUpdateResponse contains the response from method Client.Update. type ClientUpdateResponse struct { - ClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientUpdateResult contains the result from method Client.Update. -type ClientUpdateResult struct { MediaService } // ContentKeyPoliciesClientCreateOrUpdateResponse contains the response from method ContentKeyPoliciesClient.CreateOrUpdate. type ContentKeyPoliciesClientCreateOrUpdateResponse struct { - ContentKeyPoliciesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ContentKeyPoliciesClientCreateOrUpdateResult contains the result from method ContentKeyPoliciesClient.CreateOrUpdate. -type ContentKeyPoliciesClientCreateOrUpdateResult struct { ContentKeyPolicy } // ContentKeyPoliciesClientDeleteResponse contains the response from method ContentKeyPoliciesClient.Delete. type ContentKeyPoliciesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResponse contains the response from method ContentKeyPoliciesClient.GetPolicyPropertiesWithSecrets. type ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResponse struct { - ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResult contains the result from method ContentKeyPoliciesClient.GetPolicyPropertiesWithSecrets. -type ContentKeyPoliciesClientGetPolicyPropertiesWithSecretsResult struct { ContentKeyPolicyProperties } // ContentKeyPoliciesClientGetResponse contains the response from method ContentKeyPoliciesClient.Get. type ContentKeyPoliciesClientGetResponse struct { - ContentKeyPoliciesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ContentKeyPoliciesClientGetResult contains the result from method ContentKeyPoliciesClient.Get. -type ContentKeyPoliciesClientGetResult struct { ContentKeyPolicy } // ContentKeyPoliciesClientListResponse contains the response from method ContentKeyPoliciesClient.List. type ContentKeyPoliciesClientListResponse struct { - ContentKeyPoliciesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ContentKeyPoliciesClientListResult contains the result from method ContentKeyPoliciesClient.List. -type ContentKeyPoliciesClientListResult struct { ContentKeyPolicyCollection } // ContentKeyPoliciesClientUpdateResponse contains the response from method ContentKeyPoliciesClient.Update. type ContentKeyPoliciesClientUpdateResponse struct { - ContentKeyPoliciesClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ContentKeyPoliciesClientUpdateResult contains the result from method ContentKeyPoliciesClient.Update. -type ContentKeyPoliciesClientUpdateResult struct { ContentKeyPolicy } // JobsClientCancelJobResponse contains the response from method JobsClient.CancelJob. type JobsClientCancelJobResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // JobsClientCreateResponse contains the response from method JobsClient.Create. type JobsClientCreateResponse struct { - JobsClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// JobsClientCreateResult contains the result from method JobsClient.Create. -type JobsClientCreateResult struct { Job } // JobsClientDeleteResponse contains the response from method JobsClient.Delete. type JobsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // JobsClientGetResponse contains the response from method JobsClient.Get. type JobsClientGetResponse struct { - JobsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// JobsClientGetResult contains the result from method JobsClient.Get. -type JobsClientGetResult struct { Job } // JobsClientListResponse contains the response from method JobsClient.List. type JobsClientListResponse struct { - JobsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// JobsClientListResult contains the result from method JobsClient.List. -type JobsClientListResult struct { JobCollection } // JobsClientUpdateResponse contains the response from method JobsClient.Update. type JobsClientUpdateResponse struct { - JobsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// JobsClientUpdateResult contains the result from method JobsClient.Update. -type JobsClientUpdateResult struct { Job } -// LiveEventsClientAllocatePollerResponse contains the response from method LiveEventsClient.Allocate. -type LiveEventsClientAllocatePollerResponse struct { - // Poller contains an initialized poller. - Poller *LiveEventsClientAllocatePoller - - // 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 LiveEventsClientAllocatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsClientAllocateResponse, error) { - respType := LiveEventsClientAllocateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a LiveEventsClientAllocatePollerResponse from the provided client and resume token. -func (l *LiveEventsClientAllocatePollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Allocate", token, client.pl) - if err != nil { - return err - } - poller := &LiveEventsClientAllocatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // LiveEventsClientAllocateResponse contains the response from method LiveEventsClient.Allocate. type LiveEventsClientAllocateResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LiveEventsClientCreatePollerResponse contains the response from method LiveEventsClient.Create. -type LiveEventsClientCreatePollerResponse struct { - // Poller contains an initialized poller. - Poller *LiveEventsClientCreatePoller - - // 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 LiveEventsClientCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsClientCreateResponse, error) { - respType := LiveEventsClientCreateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LiveEvent) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a LiveEventsClientCreatePollerResponse from the provided client and resume token. -func (l *LiveEventsClientCreatePollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Create", token, client.pl) - if err != nil { - return err - } - poller := &LiveEventsClientCreatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // LiveEventsClientCreateResponse contains the response from method LiveEventsClient.Create. type LiveEventsClientCreateResponse struct { - LiveEventsClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LiveEventsClientCreateResult contains the result from method LiveEventsClient.Create. -type LiveEventsClientCreateResult struct { LiveEvent } -// LiveEventsClientDeletePollerResponse contains the response from method LiveEventsClient.Delete. -type LiveEventsClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *LiveEventsClientDeletePoller - - // 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 LiveEventsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsClientDeleteResponse, error) { - respType := LiveEventsClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a LiveEventsClientDeletePollerResponse from the provided client and resume token. -func (l *LiveEventsClientDeletePollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &LiveEventsClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // LiveEventsClientDeleteResponse contains the response from method LiveEventsClient.Delete. type LiveEventsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // LiveEventsClientGetResponse contains the response from method LiveEventsClient.Get. type LiveEventsClientGetResponse struct { - LiveEventsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LiveEventsClientGetResult contains the result from method LiveEventsClient.Get. -type LiveEventsClientGetResult struct { LiveEvent } // LiveEventsClientListResponse contains the response from method LiveEventsClient.List. type LiveEventsClientListResponse struct { - LiveEventsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LiveEventsClientListResult contains the result from method LiveEventsClient.List. -type LiveEventsClientListResult struct { LiveEventListResult } -// LiveEventsClientResetPollerResponse contains the response from method LiveEventsClient.Reset. -type LiveEventsClientResetPollerResponse struct { - // Poller contains an initialized poller. - Poller *LiveEventsClientResetPoller - - // 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 LiveEventsClientResetPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsClientResetResponse, error) { - respType := LiveEventsClientResetResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a LiveEventsClientResetPollerResponse from the provided client and resume token. -func (l *LiveEventsClientResetPollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Reset", token, client.pl) - if err != nil { - return err - } - poller := &LiveEventsClientResetPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // LiveEventsClientResetResponse contains the response from method LiveEventsClient.Reset. type LiveEventsClientResetResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LiveEventsClientStartPollerResponse contains the response from method LiveEventsClient.Start. -type LiveEventsClientStartPollerResponse struct { - // Poller contains an initialized poller. - Poller *LiveEventsClientStartPoller - - // 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 LiveEventsClientStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsClientStartResponse, error) { - respType := LiveEventsClientStartResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a LiveEventsClientStartPollerResponse from the provided client and resume token. -func (l *LiveEventsClientStartPollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Start", token, client.pl) - if err != nil { - return err - } - poller := &LiveEventsClientStartPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // LiveEventsClientStartResponse contains the response from method LiveEventsClient.Start. type LiveEventsClientStartResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LiveEventsClientStopPollerResponse contains the response from method LiveEventsClient.Stop. -type LiveEventsClientStopPollerResponse struct { - // Poller contains an initialized poller. - Poller *LiveEventsClientStopPoller - - // 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 LiveEventsClientStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsClientStopResponse, error) { - respType := LiveEventsClientStopResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a LiveEventsClientStopPollerResponse from the provided client and resume token. -func (l *LiveEventsClientStopPollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Stop", token, client.pl) - if err != nil { - return err - } - poller := &LiveEventsClientStopPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // LiveEventsClientStopResponse contains the response from method LiveEventsClient.Stop. type LiveEventsClientStopResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LiveEventsClientUpdatePollerResponse contains the response from method LiveEventsClient.Update. -type LiveEventsClientUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *LiveEventsClientUpdatePoller - - // 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 LiveEventsClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsClientUpdateResponse, error) { - respType := LiveEventsClientUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LiveEvent) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a LiveEventsClientUpdatePollerResponse from the provided client and resume token. -func (l *LiveEventsClientUpdatePollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Update", token, client.pl) - if err != nil { - return err - } - poller := &LiveEventsClientUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // LiveEventsClientUpdateResponse contains the response from method LiveEventsClient.Update. type LiveEventsClientUpdateResponse struct { - LiveEventsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LiveEventsClientUpdateResult contains the result from method LiveEventsClient.Update. -type LiveEventsClientUpdateResult struct { LiveEvent } -// LiveOutputsClientCreatePollerResponse contains the response from method LiveOutputsClient.Create. -type LiveOutputsClientCreatePollerResponse struct { - // Poller contains an initialized poller. - Poller *LiveOutputsClientCreatePoller - - // 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 LiveOutputsClientCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveOutputsClientCreateResponse, error) { - respType := LiveOutputsClientCreateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LiveOutput) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a LiveOutputsClientCreatePollerResponse from the provided client and resume token. -func (l *LiveOutputsClientCreatePollerResponse) Resume(ctx context.Context, client *LiveOutputsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("LiveOutputsClient.Create", token, client.pl) - if err != nil { - return err - } - poller := &LiveOutputsClientCreatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // LiveOutputsClientCreateResponse contains the response from method LiveOutputsClient.Create. type LiveOutputsClientCreateResponse struct { - LiveOutputsClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LiveOutputsClientCreateResult contains the result from method LiveOutputsClient.Create. -type LiveOutputsClientCreateResult struct { LiveOutput } -// LiveOutputsClientDeletePollerResponse contains the response from method LiveOutputsClient.Delete. -type LiveOutputsClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *LiveOutputsClientDeletePoller - - // 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 LiveOutputsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveOutputsClientDeleteResponse, error) { - respType := LiveOutputsClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a LiveOutputsClientDeletePollerResponse from the provided client and resume token. -func (l *LiveOutputsClientDeletePollerResponse) Resume(ctx context.Context, client *LiveOutputsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("LiveOutputsClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &LiveOutputsClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // LiveOutputsClientDeleteResponse contains the response from method LiveOutputsClient.Delete. type LiveOutputsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // LiveOutputsClientGetResponse contains the response from method LiveOutputsClient.Get. type LiveOutputsClientGetResponse struct { - LiveOutputsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LiveOutputsClientGetResult contains the result from method LiveOutputsClient.Get. -type LiveOutputsClientGetResult struct { LiveOutput } // LiveOutputsClientListResponse contains the response from method LiveOutputsClient.List. type LiveOutputsClientListResponse struct { - LiveOutputsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LiveOutputsClientListResult contains the result from method LiveOutputsClient.List. -type LiveOutputsClientListResult struct { LiveOutputListResult } // LocationsClientCheckNameAvailabilityResponse contains the response from method LocationsClient.CheckNameAvailability. type LocationsClientCheckNameAvailabilityResponse struct { - LocationsClientCheckNameAvailabilityResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LocationsClientCheckNameAvailabilityResult contains the result from method LocationsClient.CheckNameAvailability. -type LocationsClientCheckNameAvailabilityResult struct { EntityNameAvailabilityCheckOutput } // OperationResultsClientGetResponse contains the response from method OperationResultsClient.Get. type OperationResultsClientGetResponse struct { - OperationResultsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationResultsClientGetResult contains the result from method OperationResultsClient.Get. -type OperationResultsClientGetResult struct { AssetTrack // AzureAsyncOperation contains the information returned from the Azure-AsyncOperation header response. AzureAsyncOperation *string @@ -937,796 +283,190 @@ type OperationResultsClientGetResult struct { // OperationStatusesClientGetResponse contains the response from method OperationStatusesClient.Get. type OperationStatusesClientGetResponse struct { - OperationStatusesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationStatusesClientGetResult contains the result from method OperationStatusesClient.Get. -type OperationStatusesClientGetResult struct { AssetTrackOperationStatus } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationCollection } // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.CreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { - PrivateEndpointConnectionsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientCreateOrUpdateResult contains the result from method PrivateEndpointConnectionsClient.CreateOrUpdate. -type PrivateEndpointConnectionsClientCreateOrUpdateResult struct { PrivateEndpointConnection } // PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. type PrivateEndpointConnectionsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { - PrivateEndpointConnectionsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientGetResult contains the result from method PrivateEndpointConnectionsClient.Get. -type PrivateEndpointConnectionsClientGetResult struct { PrivateEndpointConnection } // PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.List. type PrivateEndpointConnectionsClientListResponse struct { - PrivateEndpointConnectionsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientListResult contains the result from method PrivateEndpointConnectionsClient.List. -type PrivateEndpointConnectionsClientListResult struct { PrivateEndpointConnectionListResult } // PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. type PrivateLinkResourcesClientGetResponse struct { - PrivateLinkResourcesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateLinkResourcesClientGetResult contains the result from method PrivateLinkResourcesClient.Get. -type PrivateLinkResourcesClientGetResult struct { PrivateLinkResource } // PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.List. type PrivateLinkResourcesClientListResponse struct { - PrivateLinkResourcesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateLinkResourcesClientListResult contains the result from method PrivateLinkResourcesClient.List. -type PrivateLinkResourcesClientListResult struct { PrivateLinkResourceListResult } -// StreamingEndpointsClientCreatePollerResponse contains the response from method StreamingEndpointsClient.Create. -type StreamingEndpointsClientCreatePollerResponse struct { - // Poller contains an initialized poller. - Poller *StreamingEndpointsClientCreatePoller - - // 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 StreamingEndpointsClientCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsClientCreateResponse, error) { - respType := StreamingEndpointsClientCreateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StreamingEndpoint) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a StreamingEndpointsClientCreatePollerResponse from the provided client and resume token. -func (l *StreamingEndpointsClientCreatePollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("StreamingEndpointsClient.Create", token, client.pl) - if err != nil { - return err - } - poller := &StreamingEndpointsClientCreatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // StreamingEndpointsClientCreateResponse contains the response from method StreamingEndpointsClient.Create. type StreamingEndpointsClientCreateResponse struct { - StreamingEndpointsClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingEndpointsClientCreateResult contains the result from method StreamingEndpointsClient.Create. -type StreamingEndpointsClientCreateResult struct { StreamingEndpoint } -// StreamingEndpointsClientDeletePollerResponse contains the response from method StreamingEndpointsClient.Delete. -type StreamingEndpointsClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *StreamingEndpointsClientDeletePoller - - // 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 StreamingEndpointsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsClientDeleteResponse, error) { - respType := StreamingEndpointsClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a StreamingEndpointsClientDeletePollerResponse from the provided client and resume token. -func (l *StreamingEndpointsClientDeletePollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("StreamingEndpointsClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &StreamingEndpointsClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // StreamingEndpointsClientDeleteResponse contains the response from method StreamingEndpointsClient.Delete. type StreamingEndpointsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // StreamingEndpointsClientGetResponse contains the response from method StreamingEndpointsClient.Get. type StreamingEndpointsClientGetResponse struct { - StreamingEndpointsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingEndpointsClientGetResult contains the result from method StreamingEndpointsClient.Get. -type StreamingEndpointsClientGetResult struct { StreamingEndpoint } // StreamingEndpointsClientListResponse contains the response from method StreamingEndpointsClient.List. type StreamingEndpointsClientListResponse struct { - StreamingEndpointsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingEndpointsClientListResult contains the result from method StreamingEndpointsClient.List. -type StreamingEndpointsClientListResult struct { StreamingEndpointListResult } // StreamingEndpointsClientSKUsResponse contains the response from method StreamingEndpointsClient.SKUs. type StreamingEndpointsClientSKUsResponse struct { - StreamingEndpointsClientSKUsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingEndpointsClientSKUsResult contains the result from method StreamingEndpointsClient.SKUs. -type StreamingEndpointsClientSKUsResult struct { StreamingEndpointSKUInfoListResult } -// StreamingEndpointsClientScalePollerResponse contains the response from method StreamingEndpointsClient.Scale. -type StreamingEndpointsClientScalePollerResponse struct { - // Poller contains an initialized poller. - Poller *StreamingEndpointsClientScalePoller - - // 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 StreamingEndpointsClientScalePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsClientScaleResponse, error) { - respType := StreamingEndpointsClientScaleResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a StreamingEndpointsClientScalePollerResponse from the provided client and resume token. -func (l *StreamingEndpointsClientScalePollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("StreamingEndpointsClient.Scale", token, client.pl) - if err != nil { - return err - } - poller := &StreamingEndpointsClientScalePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // StreamingEndpointsClientScaleResponse contains the response from method StreamingEndpointsClient.Scale. type StreamingEndpointsClientScaleResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingEndpointsClientStartPollerResponse contains the response from method StreamingEndpointsClient.Start. -type StreamingEndpointsClientStartPollerResponse struct { - // Poller contains an initialized poller. - Poller *StreamingEndpointsClientStartPoller - - // 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 StreamingEndpointsClientStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsClientStartResponse, error) { - respType := StreamingEndpointsClientStartResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a StreamingEndpointsClientStartPollerResponse from the provided client and resume token. -func (l *StreamingEndpointsClientStartPollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("StreamingEndpointsClient.Start", token, client.pl) - if err != nil { - return err - } - poller := &StreamingEndpointsClientStartPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // StreamingEndpointsClientStartResponse contains the response from method StreamingEndpointsClient.Start. type StreamingEndpointsClientStartResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingEndpointsClientStopPollerResponse contains the response from method StreamingEndpointsClient.Stop. -type StreamingEndpointsClientStopPollerResponse struct { - // Poller contains an initialized poller. - Poller *StreamingEndpointsClientStopPoller - - // 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 StreamingEndpointsClientStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsClientStopResponse, error) { - respType := StreamingEndpointsClientStopResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a StreamingEndpointsClientStopPollerResponse from the provided client and resume token. -func (l *StreamingEndpointsClientStopPollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("StreamingEndpointsClient.Stop", token, client.pl) - if err != nil { - return err - } - poller := &StreamingEndpointsClientStopPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // StreamingEndpointsClientStopResponse contains the response from method StreamingEndpointsClient.Stop. type StreamingEndpointsClientStopResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingEndpointsClientUpdatePollerResponse contains the response from method StreamingEndpointsClient.Update. -type StreamingEndpointsClientUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *StreamingEndpointsClientUpdatePoller - - // 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 StreamingEndpointsClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsClientUpdateResponse, error) { - respType := StreamingEndpointsClientUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StreamingEndpoint) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a StreamingEndpointsClientUpdatePollerResponse from the provided client and resume token. -func (l *StreamingEndpointsClientUpdatePollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("StreamingEndpointsClient.Update", token, client.pl) - if err != nil { - return err - } - poller := &StreamingEndpointsClientUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // StreamingEndpointsClientUpdateResponse contains the response from method StreamingEndpointsClient.Update. type StreamingEndpointsClientUpdateResponse struct { - StreamingEndpointsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingEndpointsClientUpdateResult contains the result from method StreamingEndpointsClient.Update. -type StreamingEndpointsClientUpdateResult struct { StreamingEndpoint } // StreamingLocatorsClientCreateResponse contains the response from method StreamingLocatorsClient.Create. type StreamingLocatorsClientCreateResponse struct { - StreamingLocatorsClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingLocatorsClientCreateResult contains the result from method StreamingLocatorsClient.Create. -type StreamingLocatorsClientCreateResult struct { StreamingLocator } // StreamingLocatorsClientDeleteResponse contains the response from method StreamingLocatorsClient.Delete. type StreamingLocatorsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // StreamingLocatorsClientGetResponse contains the response from method StreamingLocatorsClient.Get. type StreamingLocatorsClientGetResponse struct { - StreamingLocatorsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingLocatorsClientGetResult contains the result from method StreamingLocatorsClient.Get. -type StreamingLocatorsClientGetResult struct { StreamingLocator } // StreamingLocatorsClientListContentKeysResponse contains the response from method StreamingLocatorsClient.ListContentKeys. type StreamingLocatorsClientListContentKeysResponse struct { - StreamingLocatorsClientListContentKeysResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingLocatorsClientListContentKeysResult contains the result from method StreamingLocatorsClient.ListContentKeys. -type StreamingLocatorsClientListContentKeysResult struct { ListContentKeysResponse } // StreamingLocatorsClientListPathsResponse contains the response from method StreamingLocatorsClient.ListPaths. type StreamingLocatorsClientListPathsResponse struct { - StreamingLocatorsClientListPathsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingLocatorsClientListPathsResult contains the result from method StreamingLocatorsClient.ListPaths. -type StreamingLocatorsClientListPathsResult struct { ListPathsResponse } // StreamingLocatorsClientListResponse contains the response from method StreamingLocatorsClient.List. type StreamingLocatorsClientListResponse struct { - StreamingLocatorsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingLocatorsClientListResult contains the result from method StreamingLocatorsClient.List. -type StreamingLocatorsClientListResult struct { StreamingLocatorCollection } // StreamingPoliciesClientCreateResponse contains the response from method StreamingPoliciesClient.Create. type StreamingPoliciesClientCreateResponse struct { - StreamingPoliciesClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingPoliciesClientCreateResult contains the result from method StreamingPoliciesClient.Create. -type StreamingPoliciesClientCreateResult struct { StreamingPolicy } // StreamingPoliciesClientDeleteResponse contains the response from method StreamingPoliciesClient.Delete. type StreamingPoliciesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // StreamingPoliciesClientGetResponse contains the response from method StreamingPoliciesClient.Get. type StreamingPoliciesClientGetResponse struct { - StreamingPoliciesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingPoliciesClientGetResult contains the result from method StreamingPoliciesClient.Get. -type StreamingPoliciesClientGetResult struct { StreamingPolicy } // StreamingPoliciesClientListResponse contains the response from method StreamingPoliciesClient.List. type StreamingPoliciesClientListResponse struct { - StreamingPoliciesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// StreamingPoliciesClientListResult contains the result from method StreamingPoliciesClient.List. -type StreamingPoliciesClientListResult struct { StreamingPolicyCollection } -// TracksClientCreateOrUpdatePollerResponse contains the response from method TracksClient.CreateOrUpdate. -type TracksClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *TracksClientCreateOrUpdatePoller - - // 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 TracksClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TracksClientCreateOrUpdateResponse, error) { - respType := TracksClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AssetTrack) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a TracksClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *TracksClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *TracksClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("TracksClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &TracksClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // TracksClientCreateOrUpdateResponse contains the response from method TracksClient.CreateOrUpdate. type TracksClientCreateOrUpdateResponse struct { - TracksClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// TracksClientCreateOrUpdateResult contains the result from method TracksClient.CreateOrUpdate. -type TracksClientCreateOrUpdateResult struct { AssetTrack } -// TracksClientDeletePollerResponse contains the response from method TracksClient.Delete. -type TracksClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *TracksClientDeletePoller - - // 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 TracksClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TracksClientDeleteResponse, error) { - respType := TracksClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a TracksClientDeletePollerResponse from the provided client and resume token. -func (l *TracksClientDeletePollerResponse) Resume(ctx context.Context, client *TracksClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("TracksClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &TracksClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // TracksClientDeleteResponse contains the response from method TracksClient.Delete. type TracksClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // TracksClientGetResponse contains the response from method TracksClient.Get. type TracksClientGetResponse struct { - TracksClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// TracksClientGetResult contains the result from method TracksClient.Get. -type TracksClientGetResult struct { AssetTrack } // TracksClientListResponse contains the response from method TracksClient.List. type TracksClientListResponse struct { - TracksClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// TracksClientListResult contains the result from method TracksClient.List. -type TracksClientListResult struct { AssetTrackCollection } -// TracksClientUpdatePollerResponse contains the response from method TracksClient.Update. -type TracksClientUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *TracksClientUpdatePoller - - // 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 TracksClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TracksClientUpdateResponse, error) { - respType := TracksClientUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AssetTrack) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a TracksClientUpdatePollerResponse from the provided client and resume token. -func (l *TracksClientUpdatePollerResponse) Resume(ctx context.Context, client *TracksClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("TracksClient.Update", token, client.pl) - if err != nil { - return err - } - poller := &TracksClientUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // TracksClientUpdateResponse contains the response from method TracksClient.Update. type TracksClientUpdateResponse struct { - TracksClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// TracksClientUpdateResult contains the result from method TracksClient.Update. -type TracksClientUpdateResult struct { AssetTrack } -// TracksClientUpdateTrackDataPollerResponse contains the response from method TracksClient.UpdateTrackData. -type TracksClientUpdateTrackDataPollerResponse struct { - // Poller contains an initialized poller. - Poller *TracksClientUpdateTrackDataPoller - - // 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 TracksClientUpdateTrackDataPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TracksClientUpdateTrackDataResponse, error) { - respType := TracksClientUpdateTrackDataResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a TracksClientUpdateTrackDataPollerResponse from the provided client and resume token. -func (l *TracksClientUpdateTrackDataPollerResponse) Resume(ctx context.Context, client *TracksClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("TracksClient.UpdateTrackData", token, client.pl) - if err != nil { - return err - } - poller := &TracksClientUpdateTrackDataPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // TracksClientUpdateTrackDataResponse contains the response from method TracksClient.UpdateTrackData. type TracksClientUpdateTrackDataResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // TransformsClientCreateOrUpdateResponse contains the response from method TransformsClient.CreateOrUpdate. type TransformsClientCreateOrUpdateResponse struct { - TransformsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// TransformsClientCreateOrUpdateResult contains the result from method TransformsClient.CreateOrUpdate. -type TransformsClientCreateOrUpdateResult struct { Transform } // TransformsClientDeleteResponse contains the response from method TransformsClient.Delete. type TransformsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // TransformsClientGetResponse contains the response from method TransformsClient.Get. type TransformsClientGetResponse struct { - TransformsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// TransformsClientGetResult contains the result from method TransformsClient.Get. -type TransformsClientGetResult struct { Transform } // TransformsClientListResponse contains the response from method TransformsClient.List. type TransformsClientListResponse struct { - TransformsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// TransformsClientListResult contains the result from method TransformsClient.List. -type TransformsClientListResult struct { TransformCollection } // TransformsClientUpdateResponse contains the response from method TransformsClient.Update. type TransformsClientUpdateResponse struct { - TransformsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// TransformsClientUpdateResult contains the result from method TransformsClient.Update. -type TransformsClientUpdateResult struct { Transform } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingendpoints_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingendpoints_client.go index b59e386157ff..56279042b879 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingendpoints_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingendpoints_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type StreamingEndpointsClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewStreamingEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StreamingEndpointsClient { +func NewStreamingEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StreamingEndpointsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &StreamingEndpointsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreate - Creates a streaming endpoint. @@ -58,22 +63,16 @@ func NewStreamingEndpointsClient(subscriptionID string, credential azcore.TokenC // parameters - Streaming endpoint properties needed for creation. // options - StreamingEndpointsClientBeginCreateOptions contains the optional parameters for the StreamingEndpointsClient.BeginCreate // method. -func (client *StreamingEndpointsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEndpoint, options *StreamingEndpointsClientBeginCreateOptions) (StreamingEndpointsClientCreatePollerResponse, error) { - resp, err := client.create(ctx, resourceGroupName, accountName, streamingEndpointName, parameters, options) - if err != nil { - return StreamingEndpointsClientCreatePollerResponse{}, err - } - result := StreamingEndpointsClientCreatePollerResponse{ - RawResponse: resp, +func (client *StreamingEndpointsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEndpoint, options *StreamingEndpointsClientBeginCreateOptions) (*armruntime.Poller[StreamingEndpointsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, accountName, streamingEndpointName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[StreamingEndpointsClientCreateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[StreamingEndpointsClientCreateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("StreamingEndpointsClient.Create", "", resp, client.pl) - if err != nil { - return StreamingEndpointsClientCreatePollerResponse{}, err - } - result.Poller = &StreamingEndpointsClientCreatePoller{ - pt: pt, - } - return result, nil } // Create - Creates a streaming endpoint. @@ -133,22 +132,16 @@ func (client *StreamingEndpointsClient) createCreateRequest(ctx context.Context, // streamingEndpointName - The name of the streaming endpoint, maximum length is 24. // options - StreamingEndpointsClientBeginDeleteOptions contains the optional parameters for the StreamingEndpointsClient.BeginDelete // method. -func (client *StreamingEndpointsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsClientBeginDeleteOptions) (StreamingEndpointsClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, streamingEndpointName, options) - if err != nil { - return StreamingEndpointsClientDeletePollerResponse{}, err +func (client *StreamingEndpointsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsClientBeginDeleteOptions) (*armruntime.Poller[StreamingEndpointsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, streamingEndpointName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[StreamingEndpointsClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[StreamingEndpointsClientDeleteResponse](options.ResumeToken, client.pl, nil) } - result := StreamingEndpointsClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("StreamingEndpointsClient.Delete", "", resp, client.pl) - if err != nil { - return StreamingEndpointsClientDeletePollerResponse{}, err - } - result.Poller = &StreamingEndpointsClientDeletePoller{ - pt: pt, - } - return result, nil } // Delete - Deletes a streaming endpoint. @@ -251,7 +244,7 @@ func (client *StreamingEndpointsClient) getCreateRequest(ctx context.Context, re // getHandleResponse handles the Get response. func (client *StreamingEndpointsClient) getHandleResponse(resp *http.Response) (StreamingEndpointsClientGetResponse, error) { - result := StreamingEndpointsClientGetResponse{RawResponse: resp} + result := StreamingEndpointsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingEndpoint); err != nil { return StreamingEndpointsClientGetResponse{}, err } @@ -263,16 +256,32 @@ func (client *StreamingEndpointsClient) getHandleResponse(resp *http.Response) ( // resourceGroupName - The name of the resource group within the Azure subscription. // accountName - The Media Services account name. // options - StreamingEndpointsClientListOptions contains the optional parameters for the StreamingEndpointsClient.List method. -func (client *StreamingEndpointsClient) List(resourceGroupName string, accountName string, options *StreamingEndpointsClientListOptions) *StreamingEndpointsClientListPager { - return &StreamingEndpointsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *StreamingEndpointsClient) List(resourceGroupName string, accountName string, options *StreamingEndpointsClientListOptions) *runtime.Pager[StreamingEndpointsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[StreamingEndpointsClientListResponse]{ + More: func(page StreamingEndpointsClientListResponse) bool { + return page.ODataNextLink != nil && len(*page.ODataNextLink) > 0 }, - advancer: func(ctx context.Context, resp StreamingEndpointsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.StreamingEndpointListResult.ODataNextLink) + Fetcher: func(ctx context.Context, page *StreamingEndpointsClientListResponse) (StreamingEndpointsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink) + } + if err != nil { + return StreamingEndpointsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingEndpointsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StreamingEndpointsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -303,7 +312,7 @@ func (client *StreamingEndpointsClient) listCreateRequest(ctx context.Context, r // listHandleResponse handles the List response. func (client *StreamingEndpointsClient) listHandleResponse(resp *http.Response) (StreamingEndpointsClientListResponse, error) { - result := StreamingEndpointsClientListResponse{RawResponse: resp} + result := StreamingEndpointsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingEndpointListResult); err != nil { return StreamingEndpointsClientListResponse{}, err } @@ -363,7 +372,7 @@ func (client *StreamingEndpointsClient) skUsCreateRequest(ctx context.Context, r // skUsHandleResponse handles the SKUs response. func (client *StreamingEndpointsClient) skUsHandleResponse(resp *http.Response) (StreamingEndpointsClientSKUsResponse, error) { - result := StreamingEndpointsClientSKUsResponse{RawResponse: resp} + result := StreamingEndpointsClientSKUsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingEndpointSKUInfoListResult); err != nil { return StreamingEndpointsClientSKUsResponse{}, err } @@ -378,22 +387,16 @@ func (client *StreamingEndpointsClient) skUsHandleResponse(resp *http.Response) // parameters - Streaming endpoint scale parameters // options - StreamingEndpointsClientBeginScaleOptions contains the optional parameters for the StreamingEndpointsClient.BeginScale // method. -func (client *StreamingEndpointsClient) BeginScale(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEntityScaleUnit, options *StreamingEndpointsClientBeginScaleOptions) (StreamingEndpointsClientScalePollerResponse, error) { - resp, err := client.scale(ctx, resourceGroupName, accountName, streamingEndpointName, parameters, options) - if err != nil { - return StreamingEndpointsClientScalePollerResponse{}, err - } - result := StreamingEndpointsClientScalePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("StreamingEndpointsClient.Scale", "", resp, client.pl) - if err != nil { - return StreamingEndpointsClientScalePollerResponse{}, err +func (client *StreamingEndpointsClient) BeginScale(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEntityScaleUnit, options *StreamingEndpointsClientBeginScaleOptions) (*armruntime.Poller[StreamingEndpointsClientScaleResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.scale(ctx, resourceGroupName, accountName, streamingEndpointName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[StreamingEndpointsClientScaleResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[StreamingEndpointsClientScaleResponse](options.ResumeToken, client.pl, nil) } - result.Poller = &StreamingEndpointsClientScalePoller{ - pt: pt, - } - return result, nil } // Scale - Scales an existing streaming endpoint. @@ -450,22 +453,16 @@ func (client *StreamingEndpointsClient) scaleCreateRequest(ctx context.Context, // streamingEndpointName - The name of the streaming endpoint, maximum length is 24. // options - StreamingEndpointsClientBeginStartOptions contains the optional parameters for the StreamingEndpointsClient.BeginStart // method. -func (client *StreamingEndpointsClient) BeginStart(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsClientBeginStartOptions) (StreamingEndpointsClientStartPollerResponse, error) { - resp, err := client.start(ctx, resourceGroupName, accountName, streamingEndpointName, options) - if err != nil { - return StreamingEndpointsClientStartPollerResponse{}, err - } - result := StreamingEndpointsClientStartPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("StreamingEndpointsClient.Start", "", resp, client.pl) - if err != nil { - return StreamingEndpointsClientStartPollerResponse{}, err - } - result.Poller = &StreamingEndpointsClientStartPoller{ - pt: pt, +func (client *StreamingEndpointsClient) BeginStart(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsClientBeginStartOptions) (*armruntime.Poller[StreamingEndpointsClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, accountName, streamingEndpointName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[StreamingEndpointsClientStartResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[StreamingEndpointsClientStartResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Start - Starts an existing streaming endpoint. @@ -522,22 +519,16 @@ func (client *StreamingEndpointsClient) startCreateRequest(ctx context.Context, // streamingEndpointName - The name of the streaming endpoint, maximum length is 24. // options - StreamingEndpointsClientBeginStopOptions contains the optional parameters for the StreamingEndpointsClient.BeginStop // method. -func (client *StreamingEndpointsClient) BeginStop(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsClientBeginStopOptions) (StreamingEndpointsClientStopPollerResponse, error) { - resp, err := client.stop(ctx, resourceGroupName, accountName, streamingEndpointName, options) - if err != nil { - return StreamingEndpointsClientStopPollerResponse{}, err - } - result := StreamingEndpointsClientStopPollerResponse{ - RawResponse: resp, +func (client *StreamingEndpointsClient) BeginStop(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsClientBeginStopOptions) (*armruntime.Poller[StreamingEndpointsClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, accountName, streamingEndpointName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[StreamingEndpointsClientStopResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[StreamingEndpointsClientStopResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("StreamingEndpointsClient.Stop", "", resp, client.pl) - if err != nil { - return StreamingEndpointsClientStopPollerResponse{}, err - } - result.Poller = &StreamingEndpointsClientStopPoller{ - pt: pt, - } - return result, nil } // Stop - Stops an existing streaming endpoint. @@ -595,22 +586,16 @@ func (client *StreamingEndpointsClient) stopCreateRequest(ctx context.Context, r // parameters - Streaming endpoint properties needed for creation. // options - StreamingEndpointsClientBeginUpdateOptions contains the optional parameters for the StreamingEndpointsClient.BeginUpdate // method. -func (client *StreamingEndpointsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEndpoint, options *StreamingEndpointsClientBeginUpdateOptions) (StreamingEndpointsClientUpdatePollerResponse, error) { - resp, err := client.update(ctx, resourceGroupName, accountName, streamingEndpointName, parameters, options) - if err != nil { - return StreamingEndpointsClientUpdatePollerResponse{}, err +func (client *StreamingEndpointsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEndpoint, options *StreamingEndpointsClientBeginUpdateOptions) (*armruntime.Poller[StreamingEndpointsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, streamingEndpointName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[StreamingEndpointsClientUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[StreamingEndpointsClientUpdateResponse](options.ResumeToken, client.pl, nil) } - result := StreamingEndpointsClientUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("StreamingEndpointsClient.Update", "", resp, client.pl) - if err != nil { - return StreamingEndpointsClientUpdatePollerResponse{}, err - } - result.Poller = &StreamingEndpointsClientUpdatePoller{ - pt: pt, - } - return result, nil } // Update - Updates a existing streaming endpoint. diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streaminglocators_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streaminglocators_client.go index 13fc11a15853..b6f4f57876cf 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streaminglocators_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streaminglocators_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type StreamingLocatorsClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewStreamingLocatorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StreamingLocatorsClient { +func NewStreamingLocatorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StreamingLocatorsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &StreamingLocatorsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // Create - Create a Streaming Locator in the Media Services account @@ -105,7 +110,7 @@ func (client *StreamingLocatorsClient) createCreateRequest(ctx context.Context, // createHandleResponse handles the Create response. func (client *StreamingLocatorsClient) createHandleResponse(resp *http.Response) (StreamingLocatorsClientCreateResponse, error) { - result := StreamingLocatorsClientCreateResponse{RawResponse: resp} + result := StreamingLocatorsClientCreateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingLocator); err != nil { return StreamingLocatorsClientCreateResponse{}, err } @@ -131,7 +136,7 @@ func (client *StreamingLocatorsClient) Delete(ctx context.Context, resourceGroup if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return StreamingLocatorsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return StreamingLocatorsClientDeleteResponse{RawResponse: resp}, nil + return StreamingLocatorsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -217,7 +222,7 @@ func (client *StreamingLocatorsClient) getCreateRequest(ctx context.Context, res // getHandleResponse handles the Get response. func (client *StreamingLocatorsClient) getHandleResponse(resp *http.Response) (StreamingLocatorsClientGetResponse, error) { - result := StreamingLocatorsClientGetResponse{RawResponse: resp} + result := StreamingLocatorsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingLocator); err != nil { return StreamingLocatorsClientGetResponse{}, err } @@ -229,16 +234,32 @@ func (client *StreamingLocatorsClient) getHandleResponse(resp *http.Response) (S // resourceGroupName - The name of the resource group within the Azure subscription. // accountName - The Media Services account name. // options - StreamingLocatorsClientListOptions contains the optional parameters for the StreamingLocatorsClient.List method. -func (client *StreamingLocatorsClient) List(resourceGroupName string, accountName string, options *StreamingLocatorsClientListOptions) *StreamingLocatorsClientListPager { - return &StreamingLocatorsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *StreamingLocatorsClient) List(resourceGroupName string, accountName string, options *StreamingLocatorsClientListOptions) *runtime.Pager[StreamingLocatorsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[StreamingLocatorsClientListResponse]{ + More: func(page StreamingLocatorsClientListResponse) bool { + return page.ODataNextLink != nil && len(*page.ODataNextLink) > 0 }, - advancer: func(ctx context.Context, resp StreamingLocatorsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.StreamingLocatorCollection.ODataNextLink) + Fetcher: func(ctx context.Context, page *StreamingLocatorsClientListResponse) (StreamingLocatorsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink) + } + if err != nil { + return StreamingLocatorsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingLocatorsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StreamingLocatorsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -278,7 +299,7 @@ func (client *StreamingLocatorsClient) listCreateRequest(ctx context.Context, re // listHandleResponse handles the List response. func (client *StreamingLocatorsClient) listHandleResponse(resp *http.Response) (StreamingLocatorsClientListResponse, error) { - result := StreamingLocatorsClientListResponse{RawResponse: resp} + result := StreamingLocatorsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingLocatorCollection); err != nil { return StreamingLocatorsClientListResponse{}, err } @@ -339,7 +360,7 @@ func (client *StreamingLocatorsClient) listContentKeysCreateRequest(ctx context. // listContentKeysHandleResponse handles the ListContentKeys response. func (client *StreamingLocatorsClient) listContentKeysHandleResponse(resp *http.Response) (StreamingLocatorsClientListContentKeysResponse, error) { - result := StreamingLocatorsClientListContentKeysResponse{RawResponse: resp} + result := StreamingLocatorsClientListContentKeysResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListContentKeysResponse); err != nil { return StreamingLocatorsClientListContentKeysResponse{}, err } @@ -400,7 +421,7 @@ func (client *StreamingLocatorsClient) listPathsCreateRequest(ctx context.Contex // listPathsHandleResponse handles the ListPaths response. func (client *StreamingLocatorsClient) listPathsHandleResponse(resp *http.Response) (StreamingLocatorsClientListPathsResponse, error) { - result := StreamingLocatorsClientListPathsResponse{RawResponse: resp} + result := StreamingLocatorsClientListPathsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListPathsResponse); err != nil { return StreamingLocatorsClientListPathsResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingpolicies_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingpolicies_client.go index c65c1b968243..a067f3394036 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingpolicies_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingpolicies_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type StreamingPoliciesClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewStreamingPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StreamingPoliciesClient { +func NewStreamingPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StreamingPoliciesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &StreamingPoliciesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // Create - Create a Streaming Policy in the Media Services account @@ -105,7 +110,7 @@ func (client *StreamingPoliciesClient) createCreateRequest(ctx context.Context, // createHandleResponse handles the Create response. func (client *StreamingPoliciesClient) createHandleResponse(resp *http.Response) (StreamingPoliciesClientCreateResponse, error) { - result := StreamingPoliciesClientCreateResponse{RawResponse: resp} + result := StreamingPoliciesClientCreateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingPolicy); err != nil { return StreamingPoliciesClientCreateResponse{}, err } @@ -131,7 +136,7 @@ func (client *StreamingPoliciesClient) Delete(ctx context.Context, resourceGroup if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return StreamingPoliciesClientDeleteResponse{}, runtime.NewResponseError(resp) } - return StreamingPoliciesClientDeleteResponse{RawResponse: resp}, nil + return StreamingPoliciesClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -217,7 +222,7 @@ func (client *StreamingPoliciesClient) getCreateRequest(ctx context.Context, res // getHandleResponse handles the Get response. func (client *StreamingPoliciesClient) getHandleResponse(resp *http.Response) (StreamingPoliciesClientGetResponse, error) { - result := StreamingPoliciesClientGetResponse{RawResponse: resp} + result := StreamingPoliciesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingPolicy); err != nil { return StreamingPoliciesClientGetResponse{}, err } @@ -229,16 +234,32 @@ func (client *StreamingPoliciesClient) getHandleResponse(resp *http.Response) (S // resourceGroupName - The name of the resource group within the Azure subscription. // accountName - The Media Services account name. // options - StreamingPoliciesClientListOptions contains the optional parameters for the StreamingPoliciesClient.List method. -func (client *StreamingPoliciesClient) List(resourceGroupName string, accountName string, options *StreamingPoliciesClientListOptions) *StreamingPoliciesClientListPager { - return &StreamingPoliciesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *StreamingPoliciesClient) List(resourceGroupName string, accountName string, options *StreamingPoliciesClientListOptions) *runtime.Pager[StreamingPoliciesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[StreamingPoliciesClientListResponse]{ + More: func(page StreamingPoliciesClientListResponse) bool { + return page.ODataNextLink != nil && len(*page.ODataNextLink) > 0 }, - advancer: func(ctx context.Context, resp StreamingPoliciesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.StreamingPolicyCollection.ODataNextLink) + Fetcher: func(ctx context.Context, page *StreamingPoliciesClientListResponse) (StreamingPoliciesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink) + } + if err != nil { + return StreamingPoliciesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingPoliciesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StreamingPoliciesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -278,7 +299,7 @@ func (client *StreamingPoliciesClient) listCreateRequest(ctx context.Context, re // listHandleResponse handles the List response. func (client *StreamingPoliciesClient) listHandleResponse(resp *http.Response) (StreamingPoliciesClientListResponse, error) { - result := StreamingPoliciesClientListResponse{RawResponse: resp} + result := StreamingPoliciesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingPolicyCollection); err != nil { return StreamingPoliciesClientListResponse{}, err } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_time_rfc3339.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_time_rfc3339.go index ba8388946f2b..616c7cbb9bb4 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_tracks_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_tracks_client.go index b126832bcd41..e0daa6979a48 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_tracks_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_tracks_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type TracksClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewTracksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TracksClient { +func NewTracksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TracksClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &TracksClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Create or update a Track in the asset @@ -58,22 +63,16 @@ func NewTracksClient(subscriptionID string, credential azcore.TokenCredential, o // parameters - The request parameters // options - TracksClientBeginCreateOrUpdateOptions contains the optional parameters for the TracksClient.BeginCreateOrUpdate // method. -func (client *TracksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, assetName string, trackName string, parameters AssetTrack, options *TracksClientBeginCreateOrUpdateOptions) (TracksClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, assetName, trackName, parameters, options) - if err != nil { - return TracksClientCreateOrUpdatePollerResponse{}, err - } - result := TracksClientCreateOrUpdatePollerResponse{ - RawResponse: resp, +func (client *TracksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, assetName string, trackName string, parameters AssetTrack, options *TracksClientBeginCreateOrUpdateOptions) (*armruntime.Poller[TracksClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, assetName, trackName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[TracksClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[TracksClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("TracksClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return TracksClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &TracksClientCreateOrUpdatePoller{ - pt: pt, - } - return result, nil } // CreateOrUpdate - Create or update a Track in the asset @@ -134,22 +133,16 @@ func (client *TracksClient) createOrUpdateCreateRequest(ctx context.Context, res // assetName - The Asset name. // trackName - The Asset Track name. // options - TracksClientBeginDeleteOptions contains the optional parameters for the TracksClient.BeginDelete method. -func (client *TracksClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, assetName string, trackName string, options *TracksClientBeginDeleteOptions) (TracksClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, assetName, trackName, options) - if err != nil { - return TracksClientDeletePollerResponse{}, err - } - result := TracksClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("TracksClient.Delete", "", resp, client.pl) - if err != nil { - return TracksClientDeletePollerResponse{}, err - } - result.Poller = &TracksClientDeletePoller{ - pt: pt, +func (client *TracksClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, assetName string, trackName string, options *TracksClientBeginDeleteOptions) (*armruntime.Poller[TracksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, assetName, trackName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[TracksClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[TracksClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - Deletes a Track in the asset @@ -261,7 +254,7 @@ func (client *TracksClient) getCreateRequest(ctx context.Context, resourceGroupN // getHandleResponse handles the Get response. func (client *TracksClient) getHandleResponse(resp *http.Response) (TracksClientGetResponse, error) { - result := TracksClientGetResponse{RawResponse: resp} + result := TracksClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AssetTrack); err != nil { return TracksClientGetResponse{}, err } @@ -274,19 +267,26 @@ func (client *TracksClient) getHandleResponse(resp *http.Response) (TracksClient // accountName - The Media Services account name. // assetName - The Asset name. // options - TracksClientListOptions contains the optional parameters for the TracksClient.List method. -func (client *TracksClient) List(ctx context.Context, resourceGroupName string, accountName string, assetName string, options *TracksClientListOptions) (TracksClientListResponse, error) { - req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, assetName, options) - if err != nil { - return TracksClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return TracksClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TracksClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +func (client *TracksClient) List(resourceGroupName string, accountName string, assetName string, options *TracksClientListOptions) *runtime.Pager[TracksClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[TracksClientListResponse]{ + More: func(page TracksClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *TracksClientListResponse) (TracksClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, assetName, options) + if err != nil { + return TracksClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TracksClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TracksClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -321,7 +321,7 @@ func (client *TracksClient) listCreateRequest(ctx context.Context, resourceGroup // listHandleResponse handles the List response. func (client *TracksClient) listHandleResponse(resp *http.Response) (TracksClientListResponse, error) { - result := TracksClientListResponse{RawResponse: resp} + result := TracksClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AssetTrackCollection); err != nil { return TracksClientListResponse{}, err } @@ -336,22 +336,16 @@ func (client *TracksClient) listHandleResponse(resp *http.Response) (TracksClien // trackName - The Asset Track name. // parameters - The request parameters // options - TracksClientBeginUpdateOptions contains the optional parameters for the TracksClient.BeginUpdate method. -func (client *TracksClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, assetName string, trackName string, parameters AssetTrack, options *TracksClientBeginUpdateOptions) (TracksClientUpdatePollerResponse, error) { - resp, err := client.update(ctx, resourceGroupName, accountName, assetName, trackName, parameters, options) - if err != nil { - return TracksClientUpdatePollerResponse{}, err - } - result := TracksClientUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("TracksClient.Update", "", resp, client.pl) - if err != nil { - return TracksClientUpdatePollerResponse{}, err - } - result.Poller = &TracksClientUpdatePoller{ - pt: pt, +func (client *TracksClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, assetName string, trackName string, parameters AssetTrack, options *TracksClientBeginUpdateOptions) (*armruntime.Poller[TracksClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, assetName, trackName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[TracksClientUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[TracksClientUpdateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Update - Updates an existing Track in the asset @@ -417,22 +411,16 @@ func (client *TracksClient) updateCreateRequest(ctx context.Context, resourceGro // trackName - The Asset Track name. // options - TracksClientBeginUpdateTrackDataOptions contains the optional parameters for the TracksClient.BeginUpdateTrackData // method. -func (client *TracksClient) BeginUpdateTrackData(ctx context.Context, resourceGroupName string, accountName string, assetName string, trackName string, options *TracksClientBeginUpdateTrackDataOptions) (TracksClientUpdateTrackDataPollerResponse, error) { - resp, err := client.updateTrackData(ctx, resourceGroupName, accountName, assetName, trackName, options) - if err != nil { - return TracksClientUpdateTrackDataPollerResponse{}, err - } - result := TracksClientUpdateTrackDataPollerResponse{ - RawResponse: resp, +func (client *TracksClient) BeginUpdateTrackData(ctx context.Context, resourceGroupName string, accountName string, assetName string, trackName string, options *TracksClientBeginUpdateTrackDataOptions) (*armruntime.Poller[TracksClientUpdateTrackDataResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateTrackData(ctx, resourceGroupName, accountName, assetName, trackName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[TracksClientUpdateTrackDataResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[TracksClientUpdateTrackDataResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("TracksClient.UpdateTrackData", "", resp, client.pl) - if err != nil { - return TracksClientUpdateTrackDataPollerResponse{}, err - } - result.Poller = &TracksClientUpdateTrackDataPoller{ - pt: pt, - } - return result, nil } // UpdateTrackData - Update the track data. Call this API after any changes are made to the track data stored in the asset diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_transforms_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_transforms_client.go index cd74d7dbc7c1..ce55c2681805 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_transforms_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_transforms_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type TransformsClient struct { // subscriptionID - The unique identifier for a Microsoft Azure subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewTransformsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TransformsClient { +func NewTransformsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TransformsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &TransformsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Creates or updates a new Transform. @@ -104,7 +109,7 @@ func (client *TransformsClient) createOrUpdateCreateRequest(ctx context.Context, // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *TransformsClient) createOrUpdateHandleResponse(resp *http.Response) (TransformsClientCreateOrUpdateResponse, error) { - result := TransformsClientCreateOrUpdateResponse{RawResponse: resp} + result := TransformsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Transform); err != nil { return TransformsClientCreateOrUpdateResponse{}, err } @@ -129,7 +134,7 @@ func (client *TransformsClient) Delete(ctx context.Context, resourceGroupName st if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return TransformsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return TransformsClientDeleteResponse{RawResponse: resp}, nil + return TransformsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -215,7 +220,7 @@ func (client *TransformsClient) getCreateRequest(ctx context.Context, resourceGr // getHandleResponse handles the Get response. func (client *TransformsClient) getHandleResponse(resp *http.Response) (TransformsClientGetResponse, error) { - result := TransformsClientGetResponse{RawResponse: resp} + result := TransformsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Transform); err != nil { return TransformsClientGetResponse{}, err } @@ -227,16 +232,32 @@ func (client *TransformsClient) getHandleResponse(resp *http.Response) (Transfor // resourceGroupName - The name of the resource group within the Azure subscription. // accountName - The Media Services account name. // options - TransformsClientListOptions contains the optional parameters for the TransformsClient.List method. -func (client *TransformsClient) List(resourceGroupName string, accountName string, options *TransformsClientListOptions) *TransformsClientListPager { - return &TransformsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *TransformsClient) List(resourceGroupName string, accountName string, options *TransformsClientListOptions) *runtime.Pager[TransformsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[TransformsClientListResponse]{ + More: func(page TransformsClientListResponse) bool { + return page.ODataNextLink != nil && len(*page.ODataNextLink) > 0 }, - advancer: func(ctx context.Context, resp TransformsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.TransformCollection.ODataNextLink) + Fetcher: func(ctx context.Context, page *TransformsClientListResponse) (TransformsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink) + } + if err != nil { + return TransformsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TransformsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TransformsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -273,7 +294,7 @@ func (client *TransformsClient) listCreateRequest(ctx context.Context, resourceG // listHandleResponse handles the List response. func (client *TransformsClient) listHandleResponse(resp *http.Response) (TransformsClientListResponse, error) { - result := TransformsClientListResponse{RawResponse: resp} + result := TransformsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.TransformCollection); err != nil { return TransformsClientListResponse{}, err } @@ -334,7 +355,7 @@ func (client *TransformsClient) updateCreateRequest(ctx context.Context, resourc // updateHandleResponse handles the Update response. func (client *TransformsClient) updateHandleResponse(resp *http.Response) (TransformsClientUpdateResponse, error) { - result := TransformsClientUpdateResponse{RawResponse: resp} + result := TransformsClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Transform); err != nil { return TransformsClientUpdateResponse{}, err }