From 438bb470af0f10f6952c59605ad8d7ef86acffba Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Sun, 30 Oct 2022 21:58:15 -0400 Subject: [PATCH] [Release] sdk/resourcemanager/avs/armavs/1.1.0 (#19348) * [Release] sdk/resourcemanager/avs/armavs/2.0.0 generation from spec commit: c71a66dab813061f1d09982c2748a09317fe0860 * remove CloudError * remove /v2 version Co-authored-by: ReleaseHelper Co-authored-by: Alancere <804873052@qq.com> --- sdk/resourcemanager/avs/armavs/CHANGELOG.md | 61 + ...ated_addons_client.go => addons_client.go} | 22 +- ..._test.go => addons_client_example_test.go} | 196 +- ...ons_client.go => authorizations_client.go} | 22 +- ... => authorizations_client_example_test.go} | 39 +- sdk/resourcemanager/avs/armavs/autorest.md | 6 +- ...udlinks_client.go => cloudlinks_client.go} | 22 +- ...t.go => cloudlinks_client_example_test.go} | 45 +- ..._clusters_client.go => clusters_client.go} | 89 +- ...est.go => clusters_client_example_test.go} | 106 +- ...zz_generated_constants.go => constants.go} | 97 +- ...astores_client.go => datastores_client.go} | 22 +- ...t.go => datastores_client_example_test.go} | 51 +- ...nt.go => globalreachconnections_client.go} | 22 +- ...alreachconnections_client_example_test.go} | 47 +- sdk/resourcemanager/avs/armavs/go.mod | 4 +- sdk/resourcemanager/avs/armavs/go.sum | 8 +- ...client.go => hcxenterprisesites_client.go} | 18 +- ...hcxenterprisesites_client_example_test.go} | 39 +- ...ocations_client.go => locations_client.go} | 12 +- .../armavs/locations_client_example_test.go | 78 + .../{zz_generated_models.go => models.go} | 108 +- .../avs/armavs/models_serde.go | 4589 +++++++++++++++++ ...rations_client.go => operations_client.go} | 6 +- ...t.go => operations_client_example_test.go} | 2 +- ..._client.go => placementpolicies_client.go} | 28 +- ... placementpolicies_client_example_test.go} | 101 +- ...phic_helpers.go => polymorphic_helpers.go} | 3 + ...ouds_client.go => privateclouds_client.go} | 49 +- .../privateclouds_client_example_test.go | 381 ++ ...ed_response_types.go => response_types.go} | 16 + ...lets_client.go => scriptcmdlets_client.go} | 10 +- ...o => scriptcmdlets_client_example_test.go} | 20 +- ...s_client.go => scriptexecutions_client.go} | 26 +- ...> scriptexecutions_client_example_test.go} | 103 +- ...ges_client.go => scriptpackages_client.go} | 10 +- ... => scriptpackages_client_example_test.go} | 18 +- ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + ...es_client.go => virtualmachines_client.go} | 16 +- ...=> virtualmachines_client_example_test.go} | 36 +- ...s_client.go => workloadnetworks_client.go} | 331 +- .../workloadnetworks_client_example_test.go | 1001 ++++ ...ze_generated_example_addons_client_test.go | 125 - ...generated_example_locations_client_test.go | 59 - ...ed_example_workloadnetworks_client_test.go | 807 --- .../avs/armavs/zz_generated_models_serde.go | 905 ---- 46 files changed, 7108 insertions(+), 2649 deletions(-) rename sdk/resourcemanager/avs/armavs/{zz_generated_addons_client.go => addons_client.go} (96%) rename sdk/resourcemanager/avs/armavs/{ze_generated_example_privateclouds_client_test.go => addons_client_example_test.go} (54%) rename sdk/resourcemanager/avs/armavs/{zz_generated_authorizations_client.go => authorizations_client.go} (97%) rename sdk/resourcemanager/avs/armavs/{ze_generated_example_authorizations_client_test.go => authorizations_client_example_test.go} (74%) rename sdk/resourcemanager/avs/armavs/{zz_generated_cloudlinks_client.go => cloudlinks_client.go} (96%) rename sdk/resourcemanager/avs/armavs/{ze_generated_example_cloudlinks_client_test.go => cloudlinks_client_example_test.go} (72%) rename sdk/resourcemanager/avs/armavs/{zz_generated_clusters_client.go => clusters_client.go} (83%) rename sdk/resourcemanager/avs/armavs/{ze_generated_example_clusters_client_test.go => clusters_client_example_test.go} (54%) rename sdk/resourcemanager/avs/armavs/{zz_generated_constants.go => constants.go} (89%) rename sdk/resourcemanager/avs/armavs/{zz_generated_datastores_client.go => datastores_client.go} (97%) rename sdk/resourcemanager/avs/armavs/{ze_generated_example_datastores_client_test.go => datastores_client_example_test.go} (69%) rename sdk/resourcemanager/avs/armavs/{zz_generated_globalreachconnections_client.go => globalreachconnections_client.go} (97%) rename sdk/resourcemanager/avs/armavs/{ze_generated_example_globalreachconnections_client_test.go => globalreachconnections_client_example_test.go} (69%) rename sdk/resourcemanager/avs/armavs/{zz_generated_hcxenterprisesites_client.go => hcxenterprisesites_client.go} (97%) rename sdk/resourcemanager/avs/armavs/{ze_generated_example_hcxenterprisesites_client_test.go => hcxenterprisesites_client_example_test.go} (74%) rename sdk/resourcemanager/avs/armavs/{zz_generated_locations_client.go => locations_client.go} (96%) create mode 100644 sdk/resourcemanager/avs/armavs/locations_client_example_test.go rename sdk/resourcemanager/avs/armavs/{zz_generated_models.go => models.go} (95%) create mode 100644 sdk/resourcemanager/avs/armavs/models_serde.go rename sdk/resourcemanager/avs/armavs/{zz_generated_operations_client.go => operations_client.go} (96%) rename sdk/resourcemanager/avs/armavs/{ze_generated_example_operations_client_test.go => operations_client_example_test.go} (95%) rename sdk/resourcemanager/avs/armavs/{zz_generated_placementpolicies_client.go => placementpolicies_client.go} (97%) rename sdk/resourcemanager/avs/armavs/{ze_generated_example_placementpolicies_client_test.go => placementpolicies_client_example_test.go} (55%) rename sdk/resourcemanager/avs/armavs/{zz_generated_polymorphic_helpers.go => polymorphic_helpers.go} (97%) rename sdk/resourcemanager/avs/armavs/{zz_generated_privateclouds_client.go => privateclouds_client.go} (96%) create mode 100644 sdk/resourcemanager/avs/armavs/privateclouds_client_example_test.go rename sdk/resourcemanager/avs/armavs/{zz_generated_response_types.go => response_types.go} (97%) rename sdk/resourcemanager/avs/armavs/{zz_generated_scriptcmdlets_client.go => scriptcmdlets_client.go} (97%) rename sdk/resourcemanager/avs/armavs/{ze_generated_example_scriptcmdlets_client_test.go => scriptcmdlets_client_example_test.go} (75%) rename sdk/resourcemanager/avs/armavs/{zz_generated_scriptexecutions_client.go => scriptexecutions_client.go} (97%) rename sdk/resourcemanager/avs/armavs/{ze_generated_example_scriptexecutions_client_test.go => scriptexecutions_client_example_test.go} (56%) rename sdk/resourcemanager/avs/armavs/{zz_generated_scriptpackages_client.go => scriptpackages_client.go} (97%) rename sdk/resourcemanager/avs/armavs/{ze_generated_example_scriptpackages_client_test.go => scriptpackages_client_example_test.go} (77%) rename sdk/resourcemanager/avs/armavs/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) rename sdk/resourcemanager/avs/armavs/{zz_generated_virtualmachines_client.go => virtualmachines_client.go} (97%) rename sdk/resourcemanager/avs/armavs/{ze_generated_example_virtualmachines_client_test.go => virtualmachines_client_example_test.go} (73%) rename sdk/resourcemanager/avs/armavs/{zz_generated_workloadnetworks_client.go => workloadnetworks_client.go} (93%) create mode 100644 sdk/resourcemanager/avs/armavs/workloadnetworks_client_example_test.go delete mode 100644 sdk/resourcemanager/avs/armavs/ze_generated_example_addons_client_test.go delete mode 100644 sdk/resourcemanager/avs/armavs/ze_generated_example_locations_client_test.go delete mode 100644 sdk/resourcemanager/avs/armavs/ze_generated_example_workloadnetworks_client_test.go delete mode 100644 sdk/resourcemanager/avs/armavs/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/avs/armavs/CHANGELOG.md b/sdk/resourcemanager/avs/armavs/CHANGELOG.md index 61574b930ca8..af266b9fbfea 100644 --- a/sdk/resourcemanager/avs/armavs/CHANGELOG.md +++ b/sdk/resourcemanager/avs/armavs/CHANGELOG.md @@ -1,5 +1,66 @@ # Release History +## 1.1.0 (2022-10-13) + +### Features Added + +- New const `ExpressRouteAuthorizationProvisioningStateCanceled` +- New const `AffinityStrengthShould` +- New const `AddonTypeArc` +- New const `PrivateCloudProvisioningStateCanceled` +- New const `NsxPublicIPQuotaRaisedEnumEnabled` +- New const `AzureHybridBenefitTypeNone` +- New const `WorkloadNetworkPublicIPProvisioningStateCanceled` +- New const `WorkloadNetworkDNSServiceProvisioningStateCanceled` +- New const `WorkloadNetworkSegmentProvisioningStateCanceled` +- New const `WorkloadNetworkDNSZoneProvisioningStateCanceled` +- New const `WorkloadNetworkNameDefault` +- New const `PlacementPolicyProvisioningStateCanceled` +- New const `WorkloadNetworkDhcpProvisioningStateCanceled` +- New const `WorkloadNetworkPortMirroringProvisioningStateCanceled` +- New const `WorkloadNetworkVMGroupProvisioningStateCanceled` +- New const `NsxPublicIPQuotaRaisedEnumDisabled` +- New const `DatastoreProvisioningStateCanceled` +- New const `AzureHybridBenefitTypeSQLHost` +- New const `AddonProvisioningStateCanceled` +- New const `ClusterProvisioningStateCanceled` +- New const `AffinityStrengthMust` +- New const `GlobalReachConnectionProvisioningStateCanceled` +- New const `ScriptExecutionProvisioningStateCanceled` +- New type alias `NsxPublicIPQuotaRaisedEnum` +- New type alias `AzureHybridBenefitType` +- New type alias `AffinityStrength` +- New type alias `WorkloadNetworkName` +- New function `PossibleAzureHybridBenefitTypeValues() []AzureHybridBenefitType` +- New function `*WorkloadNetworksClient.Get(context.Context, string, string, WorkloadNetworkName, *WorkloadNetworksClientGetOptions) (WorkloadNetworksClientGetResponse, error)` +- New function `*ClustersClient.ListZones(context.Context, string, string, string, *ClustersClientListZonesOptions) (ClustersClientListZonesResponse, error)` +- New function `PossibleNsxPublicIPQuotaRaisedEnumValues() []NsxPublicIPQuotaRaisedEnum` +- New function `PossibleWorkloadNetworkNameValues() []WorkloadNetworkName` +- New function `*WorkloadNetworksClient.NewListPager(string, string, *WorkloadNetworksClientListOptions) *runtime.Pager[WorkloadNetworksClientListResponse]` +- New function `*AddonArcProperties.GetAddonProperties() *AddonProperties` +- New function `PossibleAffinityStrengthValues() []AffinityStrength` +- New struct `AddonArcProperties` +- New struct `ClusterZone` +- New struct `ClusterZoneList` +- New struct `ClustersClientListZonesOptions` +- New struct `ClustersClientListZonesResponse` +- New struct `WorkloadNetwork` +- New struct `WorkloadNetworkList` +- New struct `WorkloadNetworksClientGetOptions` +- New struct `WorkloadNetworksClientGetResponse` +- New struct `WorkloadNetworksClientListOptions` +- New struct `WorkloadNetworksClientListResponse` +- New field `AffinityStrength` in struct `PlacementPolicyUpdateProperties` +- New field `AzureHybridBenefitType` in struct `PlacementPolicyUpdateProperties` +- New field `AutoDetectedKeyVersion` in struct `EncryptionKeyVaultProperties` +- New field `SKU` in struct `LocationsClientCheckTrialAvailabilityOptions` +- New field `AzureHybridBenefitType` in struct `VMHostPlacementPolicyProperties` +- New field `AffinityStrength` in struct `VMHostPlacementPolicyProperties` +- New field `NsxPublicIPQuotaRaised` in struct `PrivateCloudProperties` +- New field `Company` in struct `ScriptPackageProperties` +- New field `URI` in struct `ScriptPackageProperties` + + ## 1.0.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_addons_client.go b/sdk/resourcemanager/avs/armavs/addons_client.go similarity index 96% rename from sdk/resourcemanager/avs/armavs/zz_generated_addons_client.go rename to sdk/resourcemanager/avs/armavs/addons_client.go index 0f503a0fc878..229cfd550953 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_addons_client.go +++ b/sdk/resourcemanager/avs/armavs/addons_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewAddonsClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreateOrUpdate - Create or update a addon in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - The name of the private cloud. // addonName - Name of the addon for the private cloud @@ -77,7 +78,7 @@ func (client *AddonsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // CreateOrUpdate - Create or update a addon in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *AddonsClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateCloudName string, addonName string, addon Addon, options *AddonsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateCloudName, addonName, addon, options) if err != nil { @@ -117,7 +118,7 @@ func (client *AddonsClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, addon) @@ -125,7 +126,7 @@ func (client *AddonsClient) createOrUpdateCreateRequest(ctx context.Context, res // BeginDelete - Delete a addon in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // addonName - Name of the addon for the private cloud @@ -144,7 +145,7 @@ func (client *AddonsClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Delete a addon in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *AddonsClient) deleteOperation(ctx context.Context, resourceGroupName string, privateCloudName string, addonName string, options *AddonsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateCloudName, addonName, options) if err != nil { @@ -184,7 +185,7 @@ func (client *AddonsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +193,7 @@ func (client *AddonsClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Get an addon by name in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // addonName - Name of the addon for the private cloud @@ -236,7 +237,7 @@ func (client *AddonsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,8 +253,7 @@ func (client *AddonsClient) getHandleResponse(resp *http.Response) (AddonsClient } // NewListPager - List addons in a private cloud -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - AddonsClientListOptions contains the optional parameters for the AddonsClient.List method. @@ -305,7 +305,7 @@ func (client *AddonsClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_privateclouds_client_test.go b/sdk/resourcemanager/avs/armavs/addons_client_example_test.go similarity index 54% rename from sdk/resourcemanager/avs/armavs/ze_generated_example_privateclouds_client_test.go rename to sdk/resourcemanager/avs/armavs/addons_client_example_test.go index 4231af8e16f3..04d61842a1ca 100644 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_privateclouds_client_test.go +++ b/sdk/resourcemanager/avs/armavs/addons_client_example_test.go @@ -17,19 +17,18 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PrivateClouds_List.json -func ExamplePrivateCloudsClient_NewListPager() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_List.json +func ExampleAddonsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPrivateCloudsClient("{subscription-id}", cred, nil) + client, err := armavs.NewAddonsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("group1", - nil) + pager := client.NewListPager("group1", "cloud1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -42,45 +41,37 @@ func ExamplePrivateCloudsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PrivateClouds_ListInSubscription.json -func ExamplePrivateCloudsClient_NewListInSubscriptionPager() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_Get_ArcReg.json +func ExampleAddonsClient_Get_addonsGetArcReg() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPrivateCloudsClient("{subscription-id}", cred, nil) + client, err := armavs.NewAddonsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListInSubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } + res, err := client.Get(ctx, "group1", "cloud1", "arc", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) } + // TODO: use response item + _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PrivateClouds_Get.json -func ExamplePrivateCloudsClient_Get() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_Get_HCX.json +func ExampleAddonsClient_Get_addonsGetHcx() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPrivateCloudsClient("{subscription-id}", cred, nil) + client, err := armavs.NewAddonsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "group1", - "cloud1", - nil) + res, err := client.Get(ctx, "group1", "cloud1", "hcx", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -88,81 +79,61 @@ func ExamplePrivateCloudsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PrivateClouds_CreateOrUpdate.json -func ExamplePrivateCloudsClient_BeginCreateOrUpdate() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_Get_SRM.json +func ExampleAddonsClient_Get_addonsGetSrm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPrivateCloudsClient("{subscription-id}", cred, nil) + client, err := armavs.NewAddonsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "group1", - "cloud1", - armavs.PrivateCloud{ - Location: to.Ptr("eastus2"), - Tags: map[string]*string{}, - Identity: &armavs.PrivateCloudIdentity{ - Type: to.Ptr(armavs.ResourceIdentityTypeSystemAssigned), - }, - Properties: &armavs.PrivateCloudProperties{ - ManagementCluster: &armavs.ManagementCluster{ - ClusterSize: to.Ptr[int32](4), - }, - NetworkBlock: to.Ptr("192.168.48.0/22"), - }, - SKU: &armavs.SKU{ - Name: to.Ptr("AV36"), - }, - }, - nil) + res, err := client.Get(ctx, "group1", "cloud1", "srm", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_Get_VR.json +func ExampleAddonsClient_Get_addonsGetVr() { + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewAddonsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "group1", "cloud1", "vr", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) } // TODO: use response item _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PrivateClouds_Update.json -func ExamplePrivateCloudsClient_BeginUpdate() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_CreateOrUpdate_ArcReg.json +func ExampleAddonsClient_BeginCreateOrUpdate_addonsCreateOrUpdateArc() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPrivateCloudsClient("{subscription-id}", cred, nil) + client, err := armavs.NewAddonsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "group1", - "cloud1", - armavs.PrivateCloudUpdate{ - Identity: &armavs.PrivateCloudIdentity{ - Type: to.Ptr(armavs.ResourceIdentityTypeNone), - }, - Properties: &armavs.PrivateCloudUpdateProperties{ - Encryption: &armavs.Encryption{ - KeyVaultProperties: &armavs.EncryptionKeyVaultProperties{ - KeyName: to.Ptr("keyname1"), - KeyVaultURL: to.Ptr("https://keyvault1-kmip-kvault.vault.azure.net/"), - KeyVersion: to.Ptr("ver1.0"), - }, - Status: to.Ptr(armavs.EncryptionStateEnabled), - }, - ManagementCluster: &armavs.ManagementCluster{ - ClusterSize: to.Ptr[int32](4), - }, - }, + poller, err := client.BeginCreateOrUpdate(ctx, "group1", "cloud1", "arc", armavs.Addon{ + Properties: &armavs.AddonArcProperties{ + AddonType: to.Ptr(armavs.AddonTypeArc), + VCenter: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg_test/providers/Microsoft.ConnectedVMwarevSphere/VCenters/test-vcenter"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -174,96 +145,107 @@ func ExamplePrivateCloudsClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PrivateClouds_Delete.json -func ExamplePrivateCloudsClient_BeginDelete() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_CreateOrUpdate_HCX.json +func ExampleAddonsClient_BeginCreateOrUpdate_addonsCreateOrUpdateHcx() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPrivateCloudsClient("{subscription-id}", cred, nil) + client, err := armavs.NewAddonsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "group1", - "cloud1", - nil) + poller, err := client.BeginCreateOrUpdate(ctx, "group1", "cloud1", "hcx", armavs.Addon{ + Properties: &armavs.AddonHcxProperties{ + AddonType: to.Ptr(armavs.AddonTypeHCX), + Offer: to.Ptr("VMware MaaS Cloud Provider (Enterprise)"), + }, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } + // TODO: use response item + _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PrivateClouds_RotateVcenterPassword.json -func ExamplePrivateCloudsClient_BeginRotateVcenterPassword() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_CreateOrUpdate_SRM.json +func ExampleAddonsClient_BeginCreateOrUpdate_addonsCreateOrUpdateSrm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPrivateCloudsClient("{subscription-id}", cred, nil) + client, err := armavs.NewAddonsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRotateVcenterPassword(ctx, - "group1", - "cloud1", - nil) + poller, err := client.BeginCreateOrUpdate(ctx, "group1", "cloud1", "srm", armavs.Addon{ + Properties: &armavs.AddonSrmProperties{ + AddonType: to.Ptr(armavs.AddonTypeSRM), + LicenseKey: to.Ptr("41915178-A8FF-4A4D-B683-6D735AF5E3F5"), + }, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } + // TODO: use response item + _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PrivateClouds_RotateNsxtPassword.json -func ExamplePrivateCloudsClient_BeginRotateNsxtPassword() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_CreateOrUpdate_VR.json +func ExampleAddonsClient_BeginCreateOrUpdate_addonsCreateOrUpdateVr() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPrivateCloudsClient("{subscription-id}", cred, nil) + client, err := armavs.NewAddonsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRotateNsxtPassword(ctx, - "group1", - "cloud1", - nil) + poller, err := client.BeginCreateOrUpdate(ctx, "group1", "cloud1", "vr", armavs.Addon{ + Properties: &armavs.AddonVrProperties{ + AddonType: to.Ptr(armavs.AddonTypeVR), + VrsCount: to.Ptr[int32](1), + }, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } + // TODO: use response item + _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PrivateClouds_ListAdminCredentials.json -func ExamplePrivateCloudsClient_ListAdminCredentials() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_Delete.json +func ExampleAddonsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPrivateCloudsClient("{subscription-id}", cred, nil) + client, err := armavs.NewAddonsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.ListAdminCredentials(ctx, - "group1", - "cloud1", - nil) + poller, err := client.BeginDelete(ctx, "group1", "cloud1", "srm", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item - _ = res + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } } diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_authorizations_client.go b/sdk/resourcemanager/avs/armavs/authorizations_client.go similarity index 97% rename from sdk/resourcemanager/avs/armavs/zz_generated_authorizations_client.go rename to sdk/resourcemanager/avs/armavs/authorizations_client.go index de52f82751d4..1188ed062981 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_authorizations_client.go +++ b/sdk/resourcemanager/avs/armavs/authorizations_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewAuthorizationsClient(subscriptionID string, credential azcore.TokenCrede // BeginCreateOrUpdate - Create or update an ExpressRoute Circuit Authorization in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - The name of the private cloud. // authorizationName - Name of the ExpressRoute Circuit Authorization in the private cloud @@ -77,7 +78,7 @@ func (client *AuthorizationsClient) BeginCreateOrUpdate(ctx context.Context, res // CreateOrUpdate - Create or update an ExpressRoute Circuit Authorization in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *AuthorizationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateCloudName string, authorizationName string, authorization ExpressRouteAuthorization, options *AuthorizationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateCloudName, authorizationName, authorization, options) if err != nil { @@ -117,7 +118,7 @@ func (client *AuthorizationsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, authorization) @@ -125,7 +126,7 @@ func (client *AuthorizationsClient) createOrUpdateCreateRequest(ctx context.Cont // BeginDelete - Delete an ExpressRoute Circuit Authorization in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // authorizationName - Name of the ExpressRoute Circuit Authorization in the private cloud @@ -145,7 +146,7 @@ func (client *AuthorizationsClient) BeginDelete(ctx context.Context, resourceGro // Delete - Delete an ExpressRoute Circuit Authorization in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *AuthorizationsClient) deleteOperation(ctx context.Context, resourceGroupName string, privateCloudName string, authorizationName string, options *AuthorizationsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateCloudName, authorizationName, options) if err != nil { @@ -185,7 +186,7 @@ func (client *AuthorizationsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,7 +194,7 @@ func (client *AuthorizationsClient) deleteCreateRequest(ctx context.Context, res // Get - Get an ExpressRoute Circuit Authorization by name in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // authorizationName - Name of the ExpressRoute Circuit Authorization in the private cloud @@ -237,7 +238,7 @@ func (client *AuthorizationsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,8 +254,7 @@ func (client *AuthorizationsClient) getHandleResponse(resp *http.Response) (Auth } // NewListPager - List ExpressRoute Circuit Authorizations in a private cloud -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - AuthorizationsClientListOptions contains the optional parameters for the AuthorizationsClient.List method. @@ -306,7 +306,7 @@ func (client *AuthorizationsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_authorizations_client_test.go b/sdk/resourcemanager/avs/armavs/authorizations_client_example_test.go similarity index 74% rename from sdk/resourcemanager/avs/armavs/ze_generated_example_authorizations_client_test.go rename to sdk/resourcemanager/avs/armavs/authorizations_client_example_test.go index 23b42a22b05b..0fd854037136 100644 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_authorizations_client_test.go +++ b/sdk/resourcemanager/avs/armavs/authorizations_client_example_test.go @@ -16,20 +16,18 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Authorizations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Authorizations_List.json func ExampleAuthorizationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewAuthorizationsClient("{subscription-id}", cred, nil) + client, err := armavs.NewAuthorizationsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("group1", - "cloud1", - nil) + pager := client.NewListPager("group1", "cloud1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -42,22 +40,18 @@ func ExampleAuthorizationsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Authorizations_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Authorizations_Get.json func ExampleAuthorizationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewAuthorizationsClient("{subscription-id}", cred, nil) + client, err := armavs.NewAuthorizationsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "group1", - "cloud1", - "authorization1", - nil) + res, err := client.Get(ctx, "group1", "cloud1", "authorization1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -65,23 +59,18 @@ func ExampleAuthorizationsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Authorizations_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Authorizations_CreateOrUpdate.json func ExampleAuthorizationsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewAuthorizationsClient("{subscription-id}", cred, nil) + client, err := armavs.NewAuthorizationsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "group1", - "cloud1", - "authorization1", - armavs.ExpressRouteAuthorization{}, - nil) + poller, err := client.BeginCreateOrUpdate(ctx, "group1", "cloud1", "authorization1", armavs.ExpressRouteAuthorization{}, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -93,22 +82,18 @@ func ExampleAuthorizationsClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Authorizations_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Authorizations_Delete.json func ExampleAuthorizationsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewAuthorizationsClient("{subscription-id}", cred, nil) + client, err := armavs.NewAuthorizationsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "group1", - "cloud1", - "authorization1", - nil) + poller, err := client.BeginDelete(ctx, "group1", "cloud1", "authorization1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/avs/armavs/autorest.md b/sdk/resourcemanager/avs/armavs/autorest.md index c8782b91ac74..aaeff310ffff 100644 --- a/sdk/resourcemanager/avs/armavs/autorest.md +++ b/sdk/resourcemanager/avs/armavs/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/vmware/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/vmware/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/c71a66dab813061f1d09982c2748a09317fe0860/specification/vmware/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/c71a66dab813061f1d09982c2748a09317fe0860/specification/vmware/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 1.1.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_cloudlinks_client.go b/sdk/resourcemanager/avs/armavs/cloudlinks_client.go similarity index 96% rename from sdk/resourcemanager/avs/armavs/zz_generated_cloudlinks_client.go rename to sdk/resourcemanager/avs/armavs/cloudlinks_client.go index c73e56999728..498c838459c2 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_cloudlinks_client.go +++ b/sdk/resourcemanager/avs/armavs/cloudlinks_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewCloudLinksClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreateOrUpdate - Create or update a cloud link in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - The name of the private cloud. // cloudLinkName - Name of the cloud link resource @@ -77,7 +78,7 @@ func (client *CloudLinksClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Create or update a cloud link in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *CloudLinksClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateCloudName string, cloudLinkName string, cloudLink CloudLink, options *CloudLinksClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateCloudName, cloudLinkName, cloudLink, options) if err != nil { @@ -117,7 +118,7 @@ func (client *CloudLinksClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, cloudLink) @@ -125,7 +126,7 @@ func (client *CloudLinksClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Delete a cloud link in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // cloudLinkName - Name of the cloud link resource @@ -144,7 +145,7 @@ func (client *CloudLinksClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Delete a cloud link in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *CloudLinksClient) deleteOperation(ctx context.Context, resourceGroupName string, privateCloudName string, cloudLinkName string, options *CloudLinksClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateCloudName, cloudLinkName, options) if err != nil { @@ -184,7 +185,7 @@ func (client *CloudLinksClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +193,7 @@ func (client *CloudLinksClient) deleteCreateRequest(ctx context.Context, resourc // Get - Get an cloud link by name in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // cloudLinkName - Name of the cloud link resource @@ -236,7 +237,7 @@ func (client *CloudLinksClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,8 +253,7 @@ func (client *CloudLinksClient) getHandleResponse(resp *http.Response) (CloudLin } // NewListPager - List cloud link in a private cloud -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - CloudLinksClientListOptions contains the optional parameters for the CloudLinksClient.List method. @@ -305,7 +305,7 @@ func (client *CloudLinksClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_cloudlinks_client_test.go b/sdk/resourcemanager/avs/armavs/cloudlinks_client_example_test.go similarity index 72% rename from sdk/resourcemanager/avs/armavs/ze_generated_example_cloudlinks_client_test.go rename to sdk/resourcemanager/avs/armavs/cloudlinks_client_example_test.go index a7dcf195b573..b71d6d70b469 100644 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_cloudlinks_client_test.go +++ b/sdk/resourcemanager/avs/armavs/cloudlinks_client_example_test.go @@ -17,20 +17,18 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/CloudLinks_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/CloudLinks_List.json func ExampleCloudLinksClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewCloudLinksClient("{subscription-id}", cred, nil) + client, err := armavs.NewCloudLinksClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("group1", - "cloud1", - nil) + pager := client.NewListPager("group1", "cloud1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,22 +41,18 @@ func ExampleCloudLinksClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/CloudLinks_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/CloudLinks_Get.json func ExampleCloudLinksClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewCloudLinksClient("{subscription-id}", cred, nil) + client, err := armavs.NewCloudLinksClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "group1", - "cloud1", - "cloudLink1", - nil) + res, err := client.Get(ctx, "group1", "cloud1", "cloudLink1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,27 +60,22 @@ func ExampleCloudLinksClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/CloudLinks_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/CloudLinks_CreateOrUpdate.json func ExampleCloudLinksClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewCloudLinksClient("{subscription-id}", cred, nil) + client, err := armavs.NewCloudLinksClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "group1", - "cloud1", - "cloudLink1", - armavs.CloudLink{ - Properties: &armavs.CloudLinkProperties{ - LinkedCloud: to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2"), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "group1", "cloud1", "cloudLink1", armavs.CloudLink{ + Properties: &armavs.CloudLinkProperties{ + LinkedCloud: to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -98,22 +87,18 @@ func ExampleCloudLinksClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/CloudLinks_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/CloudLinks_Delete.json func ExampleCloudLinksClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewCloudLinksClient("{subscription-id}", cred, nil) + client, err := armavs.NewCloudLinksClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "group1", - "cloud1", - "cloudLink1", - nil) + poller, err := client.BeginDelete(ctx, "group1", "cloud1", "cloudLink1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_clusters_client.go b/sdk/resourcemanager/avs/armavs/clusters_client.go similarity index 83% rename from sdk/resourcemanager/avs/armavs/zz_generated_clusters_client.go rename to sdk/resourcemanager/avs/armavs/clusters_client.go index ee6295d46e7a..16126d934f10 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_clusters_client.go +++ b/sdk/resourcemanager/avs/armavs/clusters_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Create or update a cluster in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - The name of the private cloud. // clusterName - Name of the cluster in the private cloud @@ -77,7 +78,7 @@ func (client *ClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create or update a cluster in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *ClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, cluster Cluster, options *ClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateCloudName, clusterName, cluster, options) if err != nil { @@ -117,7 +118,7 @@ func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, cluster) @@ -125,7 +126,7 @@ func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Delete a cluster in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -144,7 +145,7 @@ func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete a cluster in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateCloudName, clusterName, options) if err != nil { @@ -184,7 +185,7 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +193,7 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get a cluster by name in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -236,7 +237,7 @@ func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,8 +253,7 @@ func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersCl } // NewListPager - List clusters in a private cloud -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - ClustersClientListOptions contains the optional parameters for the ClustersClient.List method. @@ -305,7 +305,7 @@ func (client *ClustersClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -320,9 +320,70 @@ func (client *ClustersClient) listHandleResponse(resp *http.Response) (ClustersC return result, nil } +// ListZones - List hosts by zone in a cluster +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// privateCloudName - Name of the private cloud +// clusterName - Name of the cluster in the private cloud +// options - ClustersClientListZonesOptions contains the optional parameters for the ClustersClient.ListZones method. +func (client *ClustersClient) ListZones(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, options *ClustersClientListZonesOptions) (ClustersClientListZonesResponse, error) { + req, err := client.listZonesCreateRequest(ctx, resourceGroupName, privateCloudName, clusterName, options) + if err != nil { + return ClustersClientListZonesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClustersClientListZonesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClustersClientListZonesResponse{}, runtime.NewResponseError(resp) + } + return client.listZonesHandleResponse(resp) +} + +// listZonesCreateRequest creates the ListZones request. +func (client *ClustersClient) listZonesCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, options *ClustersClientListZonesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/listZones" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateCloudName == "" { + return nil, errors.New("parameter privateCloudName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateCloudName}", url.PathEscape(privateCloudName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listZonesHandleResponse handles the ListZones response. +func (client *ClustersClient) listZonesHandleResponse(resp *http.Response) (ClustersClientListZonesResponse, error) { + result := ClustersClientListZonesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterZoneList); err != nil { + return ClustersClientListZonesResponse{}, err + } + return result, nil +} + // BeginUpdate - Update a cluster in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -342,7 +403,7 @@ func (client *ClustersClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Update a cluster in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *ClustersClient) update(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, clusterUpdate ClusterUpdate, options *ClustersClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, privateCloudName, clusterName, clusterUpdate, options) if err != nil { @@ -382,7 +443,7 @@ func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, clusterUpdate) diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_clusters_client_test.go b/sdk/resourcemanager/avs/armavs/clusters_client_example_test.go similarity index 54% rename from sdk/resourcemanager/avs/armavs/ze_generated_example_clusters_client_test.go rename to sdk/resourcemanager/avs/armavs/clusters_client_example_test.go index efb5f9e12374..57bb53db5542 100644 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_clusters_client_test.go +++ b/sdk/resourcemanager/avs/armavs/clusters_client_example_test.go @@ -17,20 +17,18 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Clusters_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Clusters_List.json func ExampleClustersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewClustersClient("{subscription-id}", cred, nil) + client, err := armavs.NewClustersClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("group1", - "cloud1", - nil) + pager := client.NewListPager("group1", "cloud1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,22 +41,18 @@ func ExampleClustersClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Clusters_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Clusters_Get.json func ExampleClustersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewClustersClient("{subscription-id}", cred, nil) + client, err := armavs.NewClustersClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "group1", - "cloud1", - "cluster1", - nil) + res, err := client.Get(ctx, "group1", "cloud1", "cluster1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,30 +60,25 @@ func ExampleClustersClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Clusters_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Clusters_CreateOrUpdate.json func ExampleClustersClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewClustersClient("{subscription-id}", cred, nil) + client, err := armavs.NewClustersClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "group1", - "cloud1", - "cluster1", - armavs.Cluster{ - Properties: &armavs.ClusterProperties{ - ClusterSize: to.Ptr[int32](3), - }, - SKU: &armavs.SKU{ - Name: to.Ptr("AV20"), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "group1", "cloud1", "cluster1", armavs.Cluster{ + Properties: &armavs.ClusterProperties{ + ClusterSize: to.Ptr[int32](3), }, - nil) + SKU: &armavs.SKU{ + Name: to.Ptr("AV20"), + }, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -101,27 +90,22 @@ func ExampleClustersClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Clusters_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Clusters_Update.json func ExampleClustersClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewClustersClient("{subscription-id}", cred, nil) + client, err := armavs.NewClustersClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "group1", - "cloud1", - "cluster1", - armavs.ClusterUpdate{ - Properties: &armavs.ClusterUpdateProperties{ - ClusterSize: to.Ptr[int32](4), - }, + poller, err := client.BeginUpdate(ctx, "group1", "cloud1", "cluster1", armavs.ClusterUpdate{ + Properties: &armavs.ClusterUpdateProperties{ + ClusterSize: to.Ptr[int32](4), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -133,22 +117,18 @@ func ExampleClustersClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Clusters_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Clusters_Delete.json func ExampleClustersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewClustersClient("{subscription-id}", cred, nil) + client, err := armavs.NewClustersClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "group1", - "cloud1", - "cluster1", - nil) + poller, err := client.BeginDelete(ctx, "group1", "cloud1", "cluster1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -157,3 +137,41 @@ func ExampleClustersClient_BeginDelete() { log.Fatalf("failed to pull the result: %v", err) } } + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Clusters_ListZones.json +func ExampleClustersClient_ListZones_clustersListZoneData() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewClustersClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.ListZones(ctx, "group1", "cloud1", "cluster1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Clusters_ListZones_Stretched.json +func ExampleClustersClient_ListZones_clustersListZoneDataStretched() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewClustersClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.ListZones(ctx, "group1", "cloud1", "cluster1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_constants.go b/sdk/resourcemanager/avs/armavs/constants.go similarity index 89% rename from sdk/resourcemanager/avs/armavs/zz_generated_constants.go rename to sdk/resourcemanager/avs/armavs/constants.go index 6fbf230ac8c2..9f45a250f36c 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_constants.go +++ b/sdk/resourcemanager/avs/armavs/constants.go @@ -5,12 +5,13 @@ // 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. +// DO NOT EDIT. package armavs const ( moduleName = "armavs" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0" ) // AddonProvisioningState - The state of the addon provisioning @@ -18,6 +19,7 @@ type AddonProvisioningState string const ( AddonProvisioningStateBuilding AddonProvisioningState = "Building" + AddonProvisioningStateCanceled AddonProvisioningState = "Canceled" AddonProvisioningStateCancelled AddonProvisioningState = "Cancelled" AddonProvisioningStateDeleting AddonProvisioningState = "Deleting" AddonProvisioningStateFailed AddonProvisioningState = "Failed" @@ -29,6 +31,7 @@ const ( func PossibleAddonProvisioningStateValues() []AddonProvisioningState { return []AddonProvisioningState{ AddonProvisioningStateBuilding, + AddonProvisioningStateCanceled, AddonProvisioningStateCancelled, AddonProvisioningStateDeleting, AddonProvisioningStateFailed, @@ -41,6 +44,7 @@ func PossibleAddonProvisioningStateValues() []AddonProvisioningState { type AddonType string const ( + AddonTypeArc AddonType = "Arc" AddonTypeHCX AddonType = "HCX" AddonTypeSRM AddonType = "SRM" AddonTypeVR AddonType = "VR" @@ -49,12 +53,29 @@ const ( // PossibleAddonTypeValues returns the possible values for the AddonType const type. func PossibleAddonTypeValues() []AddonType { return []AddonType{ + AddonTypeArc, AddonTypeHCX, AddonTypeSRM, AddonTypeVR, } } +// AffinityStrength - VM-Host placement policy affinity strength (should/must) +type AffinityStrength string + +const ( + AffinityStrengthMust AffinityStrength = "Must" + AffinityStrengthShould AffinityStrength = "Should" +) + +// PossibleAffinityStrengthValues returns the possible values for the AffinityStrength const type. +func PossibleAffinityStrengthValues() []AffinityStrength { + return []AffinityStrength{ + AffinityStrengthMust, + AffinityStrengthShould, + } +} + // AffinityType - Placement policy affinity type type AffinityType string @@ -87,6 +108,22 @@ func PossibleAvailabilityStrategyValues() []AvailabilityStrategy { } } +// AzureHybridBenefitType - Placement policy hosts opt-in Azure Hybrid Benefit type +type AzureHybridBenefitType string + +const ( + AzureHybridBenefitTypeNone AzureHybridBenefitType = "None" + AzureHybridBenefitTypeSQLHost AzureHybridBenefitType = "SqlHost" +) + +// PossibleAzureHybridBenefitTypeValues returns the possible values for the AzureHybridBenefitType const type. +func PossibleAzureHybridBenefitTypeValues() []AzureHybridBenefitType { + return []AzureHybridBenefitType{ + AzureHybridBenefitTypeNone, + AzureHybridBenefitTypeSQLHost, + } +} + // CloudLinkStatus - The state of the cloud link. type CloudLinkStatus string @@ -113,6 +150,7 @@ func PossibleCloudLinkStatusValues() []CloudLinkStatus { type ClusterProvisioningState string const ( + ClusterProvisioningStateCanceled ClusterProvisioningState = "Canceled" ClusterProvisioningStateCancelled ClusterProvisioningState = "Cancelled" ClusterProvisioningStateDeleting ClusterProvisioningState = "Deleting" ClusterProvisioningStateFailed ClusterProvisioningState = "Failed" @@ -123,6 +161,7 @@ const ( // PossibleClusterProvisioningStateValues returns the possible values for the ClusterProvisioningState const type. func PossibleClusterProvisioningStateValues() []ClusterProvisioningState { return []ClusterProvisioningState{ + ClusterProvisioningStateCanceled, ClusterProvisioningStateCancelled, ClusterProvisioningStateDeleting, ClusterProvisioningStateFailed, @@ -173,6 +212,7 @@ func PossibleDNSServiceStatusEnumValues() []DNSServiceStatusEnum { type DatastoreProvisioningState string const ( + DatastoreProvisioningStateCanceled DatastoreProvisioningState = "Canceled" DatastoreProvisioningStateCancelled DatastoreProvisioningState = "Cancelled" DatastoreProvisioningStateCreating DatastoreProvisioningState = "Creating" DatastoreProvisioningStateDeleting DatastoreProvisioningState = "Deleting" @@ -185,6 +225,7 @@ const ( // PossibleDatastoreProvisioningStateValues returns the possible values for the DatastoreProvisioningState const type. func PossibleDatastoreProvisioningStateValues() []DatastoreProvisioningState { return []DatastoreProvisioningState{ + DatastoreProvisioningStateCanceled, DatastoreProvisioningStateCancelled, DatastoreProvisioningStateCreating, DatastoreProvisioningStateDeleting, @@ -289,6 +330,7 @@ func PossibleEncryptionVersionTypeValues() []EncryptionVersionType { type ExpressRouteAuthorizationProvisioningState string const ( + ExpressRouteAuthorizationProvisioningStateCanceled ExpressRouteAuthorizationProvisioningState = "Canceled" ExpressRouteAuthorizationProvisioningStateFailed ExpressRouteAuthorizationProvisioningState = "Failed" ExpressRouteAuthorizationProvisioningStateSucceeded ExpressRouteAuthorizationProvisioningState = "Succeeded" ExpressRouteAuthorizationProvisioningStateUpdating ExpressRouteAuthorizationProvisioningState = "Updating" @@ -297,6 +339,7 @@ const ( // PossibleExpressRouteAuthorizationProvisioningStateValues returns the possible values for the ExpressRouteAuthorizationProvisioningState const type. func PossibleExpressRouteAuthorizationProvisioningStateValues() []ExpressRouteAuthorizationProvisioningState { return []ExpressRouteAuthorizationProvisioningState{ + ExpressRouteAuthorizationProvisioningStateCanceled, ExpressRouteAuthorizationProvisioningStateFailed, ExpressRouteAuthorizationProvisioningStateSucceeded, ExpressRouteAuthorizationProvisioningStateUpdating, @@ -307,6 +350,7 @@ func PossibleExpressRouteAuthorizationProvisioningStateValues() []ExpressRouteAu type GlobalReachConnectionProvisioningState string const ( + GlobalReachConnectionProvisioningStateCanceled GlobalReachConnectionProvisioningState = "Canceled" GlobalReachConnectionProvisioningStateFailed GlobalReachConnectionProvisioningState = "Failed" GlobalReachConnectionProvisioningStateSucceeded GlobalReachConnectionProvisioningState = "Succeeded" GlobalReachConnectionProvisioningStateUpdating GlobalReachConnectionProvisioningState = "Updating" @@ -315,6 +359,7 @@ const ( // PossibleGlobalReachConnectionProvisioningStateValues returns the possible values for the GlobalReachConnectionProvisioningState const type. func PossibleGlobalReachConnectionProvisioningStateValues() []GlobalReachConnectionProvisioningState { return []GlobalReachConnectionProvisioningState{ + GlobalReachConnectionProvisioningStateCanceled, GlobalReachConnectionProvisioningStateFailed, GlobalReachConnectionProvisioningStateSucceeded, GlobalReachConnectionProvisioningStateUpdating, @@ -391,6 +436,23 @@ func PossibleMountOptionEnumValues() []MountOptionEnum { } } +// NsxPublicIPQuotaRaisedEnum - Flag to indicate whether the private cloud has the quota for provisioned NSX Public IP count +// raised from 64 to 1024 +type NsxPublicIPQuotaRaisedEnum string + +const ( + NsxPublicIPQuotaRaisedEnumDisabled NsxPublicIPQuotaRaisedEnum = "Disabled" + NsxPublicIPQuotaRaisedEnumEnabled NsxPublicIPQuotaRaisedEnum = "Enabled" +) + +// PossibleNsxPublicIPQuotaRaisedEnumValues returns the possible values for the NsxPublicIPQuotaRaisedEnum const type. +func PossibleNsxPublicIPQuotaRaisedEnumValues() []NsxPublicIPQuotaRaisedEnum { + return []NsxPublicIPQuotaRaisedEnum{ + NsxPublicIPQuotaRaisedEnumDisabled, + NsxPublicIPQuotaRaisedEnumEnabled, + } +} + // OptionalParamEnum - Is this parameter required or optional type OptionalParamEnum string @@ -412,6 +474,7 @@ type PlacementPolicyProvisioningState string const ( PlacementPolicyProvisioningStateBuilding PlacementPolicyProvisioningState = "Building" + PlacementPolicyProvisioningStateCanceled PlacementPolicyProvisioningState = "Canceled" PlacementPolicyProvisioningStateDeleting PlacementPolicyProvisioningState = "Deleting" PlacementPolicyProvisioningStateFailed PlacementPolicyProvisioningState = "Failed" PlacementPolicyProvisioningStateSucceeded PlacementPolicyProvisioningState = "Succeeded" @@ -422,6 +485,7 @@ const ( func PossiblePlacementPolicyProvisioningStateValues() []PlacementPolicyProvisioningState { return []PlacementPolicyProvisioningState{ PlacementPolicyProvisioningStateBuilding, + PlacementPolicyProvisioningStateCanceled, PlacementPolicyProvisioningStateDeleting, PlacementPolicyProvisioningStateFailed, PlacementPolicyProvisioningStateSucceeded, @@ -500,6 +564,7 @@ type PrivateCloudProvisioningState string const ( PrivateCloudProvisioningStateBuilding PrivateCloudProvisioningState = "Building" + PrivateCloudProvisioningStateCanceled PrivateCloudProvisioningState = "Canceled" PrivateCloudProvisioningStateCancelled PrivateCloudProvisioningState = "Cancelled" PrivateCloudProvisioningStateDeleting PrivateCloudProvisioningState = "Deleting" PrivateCloudProvisioningStateFailed PrivateCloudProvisioningState = "Failed" @@ -512,6 +577,7 @@ const ( func PossiblePrivateCloudProvisioningStateValues() []PrivateCloudProvisioningState { return []PrivateCloudProvisioningState{ PrivateCloudProvisioningStateBuilding, + PrivateCloudProvisioningStateCanceled, PrivateCloudProvisioningStateCancelled, PrivateCloudProvisioningStateDeleting, PrivateCloudProvisioningStateFailed, @@ -592,6 +658,7 @@ func PossibleScriptExecutionParameterTypeValues() []ScriptExecutionParameterType type ScriptExecutionProvisioningState string const ( + ScriptExecutionProvisioningStateCanceled ScriptExecutionProvisioningState = "Canceled" ScriptExecutionProvisioningStateCancelled ScriptExecutionProvisioningState = "Cancelled" ScriptExecutionProvisioningStateCancelling ScriptExecutionProvisioningState = "Cancelling" ScriptExecutionProvisioningStateDeleting ScriptExecutionProvisioningState = "Deleting" @@ -604,6 +671,7 @@ const ( // PossibleScriptExecutionProvisioningStateValues returns the possible values for the ScriptExecutionProvisioningState const type. func PossibleScriptExecutionProvisioningStateValues() []ScriptExecutionProvisioningState { return []ScriptExecutionProvisioningState{ + ScriptExecutionProvisioningStateCanceled, ScriptExecutionProvisioningStateCancelled, ScriptExecutionProvisioningStateCancelling, ScriptExecutionProvisioningStateDeleting, @@ -762,6 +830,7 @@ type WorkloadNetworkDNSServiceProvisioningState string const ( WorkloadNetworkDNSServiceProvisioningStateBuilding WorkloadNetworkDNSServiceProvisioningState = "Building" + WorkloadNetworkDNSServiceProvisioningStateCanceled WorkloadNetworkDNSServiceProvisioningState = "Canceled" WorkloadNetworkDNSServiceProvisioningStateDeleting WorkloadNetworkDNSServiceProvisioningState = "Deleting" WorkloadNetworkDNSServiceProvisioningStateFailed WorkloadNetworkDNSServiceProvisioningState = "Failed" WorkloadNetworkDNSServiceProvisioningStateSucceeded WorkloadNetworkDNSServiceProvisioningState = "Succeeded" @@ -772,6 +841,7 @@ const ( func PossibleWorkloadNetworkDNSServiceProvisioningStateValues() []WorkloadNetworkDNSServiceProvisioningState { return []WorkloadNetworkDNSServiceProvisioningState{ WorkloadNetworkDNSServiceProvisioningStateBuilding, + WorkloadNetworkDNSServiceProvisioningStateCanceled, WorkloadNetworkDNSServiceProvisioningStateDeleting, WorkloadNetworkDNSServiceProvisioningStateFailed, WorkloadNetworkDNSServiceProvisioningStateSucceeded, @@ -784,6 +854,7 @@ type WorkloadNetworkDNSZoneProvisioningState string const ( WorkloadNetworkDNSZoneProvisioningStateBuilding WorkloadNetworkDNSZoneProvisioningState = "Building" + WorkloadNetworkDNSZoneProvisioningStateCanceled WorkloadNetworkDNSZoneProvisioningState = "Canceled" WorkloadNetworkDNSZoneProvisioningStateDeleting WorkloadNetworkDNSZoneProvisioningState = "Deleting" WorkloadNetworkDNSZoneProvisioningStateFailed WorkloadNetworkDNSZoneProvisioningState = "Failed" WorkloadNetworkDNSZoneProvisioningStateSucceeded WorkloadNetworkDNSZoneProvisioningState = "Succeeded" @@ -794,6 +865,7 @@ const ( func PossibleWorkloadNetworkDNSZoneProvisioningStateValues() []WorkloadNetworkDNSZoneProvisioningState { return []WorkloadNetworkDNSZoneProvisioningState{ WorkloadNetworkDNSZoneProvisioningStateBuilding, + WorkloadNetworkDNSZoneProvisioningStateCanceled, WorkloadNetworkDNSZoneProvisioningStateDeleting, WorkloadNetworkDNSZoneProvisioningStateFailed, WorkloadNetworkDNSZoneProvisioningStateSucceeded, @@ -806,6 +878,7 @@ type WorkloadNetworkDhcpProvisioningState string const ( WorkloadNetworkDhcpProvisioningStateBuilding WorkloadNetworkDhcpProvisioningState = "Building" + WorkloadNetworkDhcpProvisioningStateCanceled WorkloadNetworkDhcpProvisioningState = "Canceled" WorkloadNetworkDhcpProvisioningStateDeleting WorkloadNetworkDhcpProvisioningState = "Deleting" WorkloadNetworkDhcpProvisioningStateFailed WorkloadNetworkDhcpProvisioningState = "Failed" WorkloadNetworkDhcpProvisioningStateSucceeded WorkloadNetworkDhcpProvisioningState = "Succeeded" @@ -816,6 +889,7 @@ const ( func PossibleWorkloadNetworkDhcpProvisioningStateValues() []WorkloadNetworkDhcpProvisioningState { return []WorkloadNetworkDhcpProvisioningState{ WorkloadNetworkDhcpProvisioningStateBuilding, + WorkloadNetworkDhcpProvisioningStateCanceled, WorkloadNetworkDhcpProvisioningStateDeleting, WorkloadNetworkDhcpProvisioningStateFailed, WorkloadNetworkDhcpProvisioningStateSucceeded, @@ -823,11 +897,25 @@ func PossibleWorkloadNetworkDhcpProvisioningStateValues() []WorkloadNetworkDhcpP } } +type WorkloadNetworkName string + +const ( + WorkloadNetworkNameDefault WorkloadNetworkName = "default" +) + +// PossibleWorkloadNetworkNameValues returns the possible values for the WorkloadNetworkName const type. +func PossibleWorkloadNetworkNameValues() []WorkloadNetworkName { + return []WorkloadNetworkName{ + WorkloadNetworkNameDefault, + } +} + // WorkloadNetworkPortMirroringProvisioningState - The provisioning state type WorkloadNetworkPortMirroringProvisioningState string const ( WorkloadNetworkPortMirroringProvisioningStateBuilding WorkloadNetworkPortMirroringProvisioningState = "Building" + WorkloadNetworkPortMirroringProvisioningStateCanceled WorkloadNetworkPortMirroringProvisioningState = "Canceled" WorkloadNetworkPortMirroringProvisioningStateDeleting WorkloadNetworkPortMirroringProvisioningState = "Deleting" WorkloadNetworkPortMirroringProvisioningStateFailed WorkloadNetworkPortMirroringProvisioningState = "Failed" WorkloadNetworkPortMirroringProvisioningStateSucceeded WorkloadNetworkPortMirroringProvisioningState = "Succeeded" @@ -838,6 +926,7 @@ const ( func PossibleWorkloadNetworkPortMirroringProvisioningStateValues() []WorkloadNetworkPortMirroringProvisioningState { return []WorkloadNetworkPortMirroringProvisioningState{ WorkloadNetworkPortMirroringProvisioningStateBuilding, + WorkloadNetworkPortMirroringProvisioningStateCanceled, WorkloadNetworkPortMirroringProvisioningStateDeleting, WorkloadNetworkPortMirroringProvisioningStateFailed, WorkloadNetworkPortMirroringProvisioningStateSucceeded, @@ -850,6 +939,7 @@ type WorkloadNetworkPublicIPProvisioningState string const ( WorkloadNetworkPublicIPProvisioningStateBuilding WorkloadNetworkPublicIPProvisioningState = "Building" + WorkloadNetworkPublicIPProvisioningStateCanceled WorkloadNetworkPublicIPProvisioningState = "Canceled" WorkloadNetworkPublicIPProvisioningStateDeleting WorkloadNetworkPublicIPProvisioningState = "Deleting" WorkloadNetworkPublicIPProvisioningStateFailed WorkloadNetworkPublicIPProvisioningState = "Failed" WorkloadNetworkPublicIPProvisioningStateSucceeded WorkloadNetworkPublicIPProvisioningState = "Succeeded" @@ -860,6 +950,7 @@ const ( func PossibleWorkloadNetworkPublicIPProvisioningStateValues() []WorkloadNetworkPublicIPProvisioningState { return []WorkloadNetworkPublicIPProvisioningState{ WorkloadNetworkPublicIPProvisioningStateBuilding, + WorkloadNetworkPublicIPProvisioningStateCanceled, WorkloadNetworkPublicIPProvisioningStateDeleting, WorkloadNetworkPublicIPProvisioningStateFailed, WorkloadNetworkPublicIPProvisioningStateSucceeded, @@ -872,6 +963,7 @@ type WorkloadNetworkSegmentProvisioningState string const ( WorkloadNetworkSegmentProvisioningStateBuilding WorkloadNetworkSegmentProvisioningState = "Building" + WorkloadNetworkSegmentProvisioningStateCanceled WorkloadNetworkSegmentProvisioningState = "Canceled" WorkloadNetworkSegmentProvisioningStateDeleting WorkloadNetworkSegmentProvisioningState = "Deleting" WorkloadNetworkSegmentProvisioningStateFailed WorkloadNetworkSegmentProvisioningState = "Failed" WorkloadNetworkSegmentProvisioningStateSucceeded WorkloadNetworkSegmentProvisioningState = "Succeeded" @@ -882,6 +974,7 @@ const ( func PossibleWorkloadNetworkSegmentProvisioningStateValues() []WorkloadNetworkSegmentProvisioningState { return []WorkloadNetworkSegmentProvisioningState{ WorkloadNetworkSegmentProvisioningStateBuilding, + WorkloadNetworkSegmentProvisioningStateCanceled, WorkloadNetworkSegmentProvisioningStateDeleting, WorkloadNetworkSegmentProvisioningStateFailed, WorkloadNetworkSegmentProvisioningStateSucceeded, @@ -894,6 +987,7 @@ type WorkloadNetworkVMGroupProvisioningState string const ( WorkloadNetworkVMGroupProvisioningStateBuilding WorkloadNetworkVMGroupProvisioningState = "Building" + WorkloadNetworkVMGroupProvisioningStateCanceled WorkloadNetworkVMGroupProvisioningState = "Canceled" WorkloadNetworkVMGroupProvisioningStateDeleting WorkloadNetworkVMGroupProvisioningState = "Deleting" WorkloadNetworkVMGroupProvisioningStateFailed WorkloadNetworkVMGroupProvisioningState = "Failed" WorkloadNetworkVMGroupProvisioningStateSucceeded WorkloadNetworkVMGroupProvisioningState = "Succeeded" @@ -904,6 +998,7 @@ const ( func PossibleWorkloadNetworkVMGroupProvisioningStateValues() []WorkloadNetworkVMGroupProvisioningState { return []WorkloadNetworkVMGroupProvisioningState{ WorkloadNetworkVMGroupProvisioningStateBuilding, + WorkloadNetworkVMGroupProvisioningStateCanceled, WorkloadNetworkVMGroupProvisioningStateDeleting, WorkloadNetworkVMGroupProvisioningStateFailed, WorkloadNetworkVMGroupProvisioningStateSucceeded, diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_datastores_client.go b/sdk/resourcemanager/avs/armavs/datastores_client.go similarity index 97% rename from sdk/resourcemanager/avs/armavs/zz_generated_datastores_client.go rename to sdk/resourcemanager/avs/armavs/datastores_client.go index 3199bbec9792..bc67afa7928c 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_datastores_client.go +++ b/sdk/resourcemanager/avs/armavs/datastores_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewDatastoresClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreateOrUpdate - Create or update a datastore in a private cloud cluster // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -78,7 +79,7 @@ func (client *DatastoresClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Create or update a datastore in a private cloud cluster // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *DatastoresClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, datastoreName string, datastore Datastore, options *DatastoresClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateCloudName, clusterName, datastoreName, datastore, options) if err != nil { @@ -122,7 +123,7 @@ func (client *DatastoresClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, datastore) @@ -130,7 +131,7 @@ func (client *DatastoresClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Delete a datastore in a private cloud cluster // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -150,7 +151,7 @@ func (client *DatastoresClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Delete a datastore in a private cloud cluster // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *DatastoresClient) deleteOperation(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, datastoreName string, options *DatastoresClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateCloudName, clusterName, datastoreName, options) if err != nil { @@ -194,7 +195,7 @@ func (client *DatastoresClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +203,7 @@ func (client *DatastoresClient) deleteCreateRequest(ctx context.Context, resourc // Get - Get a datastore in a private cloud cluster // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -251,7 +252,7 @@ func (client *DatastoresClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,8 +268,7 @@ func (client *DatastoresClient) getHandleResponse(resp *http.Response) (Datastor } // NewListPager - List datastores in a private cloud cluster -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -325,7 +325,7 @@ func (client *DatastoresClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_datastores_client_test.go b/sdk/resourcemanager/avs/armavs/datastores_client_example_test.go similarity index 69% rename from sdk/resourcemanager/avs/armavs/ze_generated_example_datastores_client_test.go rename to sdk/resourcemanager/avs/armavs/datastores_client_example_test.go index 88cf7f51c857..8ebfe3a6eb18 100644 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_datastores_client_test.go +++ b/sdk/resourcemanager/avs/armavs/datastores_client_example_test.go @@ -17,21 +17,18 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Datastores_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Datastores_List.json func ExampleDatastoresClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewDatastoresClient("{subscription-id}", cred, nil) + client, err := armavs.NewDatastoresClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("group1", - "cloud1", - "cluster1", - nil) + pager := client.NewListPager("group1", "cloud1", "cluster1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -44,23 +41,18 @@ func ExampleDatastoresClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Datastores_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Datastores_Get.json func ExampleDatastoresClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewDatastoresClient("{subscription-id}", cred, nil) + client, err := armavs.NewDatastoresClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "group1", - "cloud1", - "cluster1", - "datastore1", - nil) + res, err := client.Get(ctx, "group1", "cloud1", "cluster1", "datastore1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -68,30 +60,24 @@ func ExampleDatastoresClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Datastores_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Datastores_CreateOrUpdate.json func ExampleDatastoresClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewDatastoresClient("{subscription-id}", cred, nil) + client, err := armavs.NewDatastoresClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "group1", - "cloud1", - "cluster1", - "datastore1", - armavs.Datastore{ - Properties: &armavs.DatastoreProperties{ - NetAppVolume: &armavs.NetAppVolume{ - ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/ResourceGroup1/providers/Microsoft.NetApp/netAppAccounts/NetAppAccount1/capacityPools/CapacityPool1/volumes/NFSVol1"), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "group1", "cloud1", "cluster1", "datastore1", armavs.Datastore{ + Properties: &armavs.DatastoreProperties{ + NetAppVolume: &armavs.NetAppVolume{ + ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/ResourceGroup1/providers/Microsoft.NetApp/netAppAccounts/NetAppAccount1/capacityPools/CapacityPool1/volumes/NFSVol1"), }, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -103,23 +89,18 @@ func ExampleDatastoresClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Datastores_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Datastores_Delete.json func ExampleDatastoresClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewDatastoresClient("{subscription-id}", cred, nil) + client, err := armavs.NewDatastoresClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "group1", - "cloud1", - "cluster1", - "datastore1", - nil) + poller, err := client.BeginDelete(ctx, "group1", "cloud1", "cluster1", "datastore1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_globalreachconnections_client.go b/sdk/resourcemanager/avs/armavs/globalreachconnections_client.go similarity index 97% rename from sdk/resourcemanager/avs/armavs/zz_generated_globalreachconnections_client.go rename to sdk/resourcemanager/avs/armavs/globalreachconnections_client.go index 9e91cd2b5996..9241b60a3440 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_globalreachconnections_client.go +++ b/sdk/resourcemanager/avs/armavs/globalreachconnections_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewGlobalReachConnectionsClient(subscriptionID string, credential azcore.To // BeginCreateOrUpdate - Create or update a global reach connection in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - The name of the private cloud. // globalReachConnectionName - Name of the global reach connection in the private cloud @@ -77,7 +78,7 @@ func (client *GlobalReachConnectionsClient) BeginCreateOrUpdate(ctx context.Cont // CreateOrUpdate - Create or update a global reach connection in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *GlobalReachConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateCloudName string, globalReachConnectionName string, globalReachConnection GlobalReachConnection, options *GlobalReachConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateCloudName, globalReachConnectionName, globalReachConnection, options) if err != nil { @@ -117,7 +118,7 @@ func (client *GlobalReachConnectionsClient) createOrUpdateCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, globalReachConnection) @@ -125,7 +126,7 @@ func (client *GlobalReachConnectionsClient) createOrUpdateCreateRequest(ctx cont // BeginDelete - Delete a global reach connection in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // globalReachConnectionName - Name of the global reach connection in the private cloud @@ -145,7 +146,7 @@ func (client *GlobalReachConnectionsClient) BeginDelete(ctx context.Context, res // Delete - Delete a global reach connection in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *GlobalReachConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, privateCloudName string, globalReachConnectionName string, options *GlobalReachConnectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateCloudName, globalReachConnectionName, options) if err != nil { @@ -185,7 +186,7 @@ func (client *GlobalReachConnectionsClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,7 +194,7 @@ func (client *GlobalReachConnectionsClient) deleteCreateRequest(ctx context.Cont // Get - Get a global reach connection by name in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // globalReachConnectionName - Name of the global reach connection in the private cloud @@ -238,7 +239,7 @@ func (client *GlobalReachConnectionsClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,8 +255,7 @@ func (client *GlobalReachConnectionsClient) getHandleResponse(resp *http.Respons } // NewListPager - List global reach connections in a private cloud -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - GlobalReachConnectionsClientListOptions contains the optional parameters for the GlobalReachConnectionsClient.List @@ -308,7 +308,7 @@ func (client *GlobalReachConnectionsClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_globalreachconnections_client_test.go b/sdk/resourcemanager/avs/armavs/globalreachconnections_client_example_test.go similarity index 69% rename from sdk/resourcemanager/avs/armavs/ze_generated_example_globalreachconnections_client_test.go rename to sdk/resourcemanager/avs/armavs/globalreachconnections_client_example_test.go index d872f81fe6a3..37f86f6a8730 100644 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_globalreachconnections_client_test.go +++ b/sdk/resourcemanager/avs/armavs/globalreachconnections_client_example_test.go @@ -17,20 +17,18 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/GlobalReachConnections_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/GlobalReachConnections_List.json func ExampleGlobalReachConnectionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewGlobalReachConnectionsClient("{subscription-id}", cred, nil) + client, err := armavs.NewGlobalReachConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("group1", - "cloud1", - nil) + pager := client.NewListPager("group1", "cloud1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,22 +41,18 @@ func ExampleGlobalReachConnectionsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/GlobalReachConnections_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/GlobalReachConnections_Get.json func ExampleGlobalReachConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewGlobalReachConnectionsClient("{subscription-id}", cred, nil) + client, err := armavs.NewGlobalReachConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "group1", - "cloud1", - "connection1", - nil) + res, err := client.Get(ctx, "group1", "cloud1", "connection1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,28 +60,23 @@ func ExampleGlobalReachConnectionsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/GlobalReachConnections_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/GlobalReachConnections_CreateOrUpdate.json func ExampleGlobalReachConnectionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewGlobalReachConnectionsClient("{subscription-id}", cred, nil) + client, err := armavs.NewGlobalReachConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "group1", - "cloud1", - "connection1", - armavs.GlobalReachConnection{ - Properties: &armavs.GlobalReachConnectionProperties{ - AuthorizationKey: to.Ptr("01010101-0101-0101-0101-010101010101"), - PeerExpressRouteCircuit: to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.Network/expressRouteCircuits/mypeer"), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "group1", "cloud1", "connection1", armavs.GlobalReachConnection{ + Properties: &armavs.GlobalReachConnectionProperties{ + AuthorizationKey: to.Ptr("01010101-0101-0101-0101-010101010101"), + PeerExpressRouteCircuit: to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.Network/expressRouteCircuits/mypeer"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -99,22 +88,18 @@ func ExampleGlobalReachConnectionsClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/GlobalReachConnections_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/GlobalReachConnections_Delete.json func ExampleGlobalReachConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewGlobalReachConnectionsClient("{subscription-id}", cred, nil) + client, err := armavs.NewGlobalReachConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "group1", - "cloud1", - "connection1", - nil) + poller, err := client.BeginDelete(ctx, "group1", "cloud1", "connection1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/avs/armavs/go.mod b/sdk/resourcemanager/avs/armavs/go.mod index 2d40b2446641..ca105433ea91 100644 --- a/sdk/resourcemanager/avs/armavs/go.mod +++ b/sdk/resourcemanager/avs/armavs/go.mod @@ -4,12 +4,12 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 ) require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // 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 diff --git a/sdk/resourcemanager/avs/armavs/go.sum b/sdk/resourcemanager/avs/armavs/go.sum index ed5b814680ee..8828b17b1853 100644 --- a/sdk/resourcemanager/avs/armavs/go.sum +++ b/sdk/resourcemanager/avs/armavs/go.sum @@ -1,11 +1,11 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -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/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_hcxenterprisesites_client.go b/sdk/resourcemanager/avs/armavs/hcxenterprisesites_client.go similarity index 97% rename from sdk/resourcemanager/avs/armavs/zz_generated_hcxenterprisesites_client.go rename to sdk/resourcemanager/avs/armavs/hcxenterprisesites_client.go index eb5a019da15a..8283a5dceb39 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_hcxenterprisesites_client.go +++ b/sdk/resourcemanager/avs/armavs/hcxenterprisesites_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewHcxEnterpriseSitesClient(subscriptionID string, credential azcore.TokenC // CreateOrUpdate - Create or update an HCX Enterprise Site in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - The name of the private cloud. // hcxEnterpriseSiteName - Name of the HCX Enterprise Site in the private cloud @@ -102,7 +103,7 @@ func (client *HcxEnterpriseSitesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, hcxEnterpriseSite) @@ -119,7 +120,7 @@ func (client *HcxEnterpriseSitesClient) createOrUpdateHandleResponse(resp *http. // Delete - Delete an HCX Enterprise Site in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // hcxEnterpriseSiteName - Name of the HCX Enterprise Site in the private cloud @@ -164,7 +165,7 @@ func (client *HcxEnterpriseSitesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -172,7 +173,7 @@ func (client *HcxEnterpriseSitesClient) deleteCreateRequest(ctx context.Context, // Get - Get an HCX Enterprise Site by name in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // hcxEnterpriseSiteName - Name of the HCX Enterprise Site in the private cloud @@ -216,7 +217,7 @@ func (client *HcxEnterpriseSitesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -232,8 +233,7 @@ func (client *HcxEnterpriseSitesClient) getHandleResponse(resp *http.Response) ( } // NewListPager - List HCX Enterprise Sites in a private cloud -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - HcxEnterpriseSitesClientListOptions contains the optional parameters for the HcxEnterpriseSitesClient.List method. @@ -285,7 +285,7 @@ func (client *HcxEnterpriseSitesClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_hcxenterprisesites_client_test.go b/sdk/resourcemanager/avs/armavs/hcxenterprisesites_client_example_test.go similarity index 74% rename from sdk/resourcemanager/avs/armavs/ze_generated_example_hcxenterprisesites_client_test.go rename to sdk/resourcemanager/avs/armavs/hcxenterprisesites_client_example_test.go index e5caa9dc010c..15b7b83bde51 100644 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_hcxenterprisesites_client_test.go +++ b/sdk/resourcemanager/avs/armavs/hcxenterprisesites_client_example_test.go @@ -16,20 +16,18 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/HcxEnterpriseSites_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/HcxEnterpriseSites_List.json func ExampleHcxEnterpriseSitesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewHcxEnterpriseSitesClient("{subscription-id}", cred, nil) + client, err := armavs.NewHcxEnterpriseSitesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("group1", - "cloud1", - nil) + pager := client.NewListPager("group1", "cloud1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -42,22 +40,18 @@ func ExampleHcxEnterpriseSitesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/HcxEnterpriseSites_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/HcxEnterpriseSites_Get.json func ExampleHcxEnterpriseSitesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewHcxEnterpriseSitesClient("{subscription-id}", cred, nil) + client, err := armavs.NewHcxEnterpriseSitesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "group1", - "cloud1", - "site1", - nil) + res, err := client.Get(ctx, "group1", "cloud1", "site1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -65,23 +59,18 @@ func ExampleHcxEnterpriseSitesClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/HcxEnterpriseSites_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/HcxEnterpriseSites_CreateOrUpdate.json func ExampleHcxEnterpriseSitesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewHcxEnterpriseSitesClient("{subscription-id}", cred, nil) + client, err := armavs.NewHcxEnterpriseSitesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateOrUpdate(ctx, - "group1", - "cloud1", - "site1", - armavs.HcxEnterpriseSite{}, - nil) + res, err := client.CreateOrUpdate(ctx, "group1", "cloud1", "site1", armavs.HcxEnterpriseSite{}, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -89,22 +78,18 @@ func ExampleHcxEnterpriseSitesClient_CreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/HcxEnterpriseSites_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/HcxEnterpriseSites_Delete.json func ExampleHcxEnterpriseSitesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewHcxEnterpriseSitesClient("{subscription-id}", cred, nil) + client, err := armavs.NewHcxEnterpriseSitesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "group1", - "cloud1", - "site1", - nil) + _, err = client.Delete(ctx, "group1", "cloud1", "site1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_locations_client.go b/sdk/resourcemanager/avs/armavs/locations_client.go similarity index 96% rename from sdk/resourcemanager/avs/armavs/zz_generated_locations_client.go rename to sdk/resourcemanager/avs/armavs/locations_client.go index 9a60b1f20319..6490acf6ee78 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_locations_client.go +++ b/sdk/resourcemanager/avs/armavs/locations_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential // CheckQuotaAvailability - Return quota for subscription by region // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // location - Azure region // options - LocationsClientCheckQuotaAvailabilityOptions contains the optional parameters for the LocationsClient.CheckQuotaAvailability // method. @@ -91,7 +92,7 @@ func (client *LocationsClient) checkQuotaAvailabilityCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,7 +109,7 @@ func (client *LocationsClient) checkQuotaAvailabilityHandleResponse(resp *http.R // CheckTrialAvailability - Return trial status for subscription by region // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // location - Azure region // options - LocationsClientCheckTrialAvailabilityOptions contains the optional parameters for the LocationsClient.CheckTrialAvailability // method. @@ -143,9 +144,12 @@ func (client *LocationsClient) checkTrialAvailabilityCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.SKU != nil { + return req, runtime.MarshalAsJSON(req, *options.SKU) + } return req, nil } diff --git a/sdk/resourcemanager/avs/armavs/locations_client_example_test.go b/sdk/resourcemanager/avs/armavs/locations_client_example_test.go new file mode 100644 index 000000000000..b5e0b9fe700e --- /dev/null +++ b/sdk/resourcemanager/avs/armavs/locations_client_example_test.go @@ -0,0 +1,78 @@ +//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 armavs_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Locations_CheckTrialAvailability.json +func ExampleLocationsClient_CheckTrialAvailability_locationsCheckTrialAvailability() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewLocationsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CheckTrialAvailability(ctx, "eastus", &armavs.LocationsClientCheckTrialAvailabilityOptions{SKU: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Locations_CheckTrialAvailabilityWithSku.json +func ExampleLocationsClient_CheckTrialAvailability_locationsCheckTrialAvailabilityWithSku() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewLocationsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CheckTrialAvailability(ctx, "eastus", &armavs.LocationsClientCheckTrialAvailabilityOptions{SKU: &armavs.SKU{ + Name: to.Ptr("avs52t"), + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Locations_CheckQuotaAvailability.json +func ExampleLocationsClient_CheckQuotaAvailability() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewLocationsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CheckQuotaAvailability(ctx, "eastus", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_models.go b/sdk/resourcemanager/avs/armavs/models.go similarity index 95% rename from sdk/resourcemanager/avs/armavs/zz_generated_models.go rename to sdk/resourcemanager/avs/armavs/models.go index fa02020267e4..7e22dd66ba28 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_models.go +++ b/sdk/resourcemanager/avs/armavs/models.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -25,6 +26,26 @@ type Addon struct { Type *string `json:"type,omitempty" azure:"ro"` } +// AddonArcProperties - The properties of an Arc addon +type AddonArcProperties struct { + // REQUIRED; The type of private cloud addon + AddonType *AddonType `json:"addonType,omitempty"` + + // The VMware vCenter resource ID + VCenter *string `json:"vCenter,omitempty"` + + // READ-ONLY; The state of the addon provisioning + ProvisioningState *AddonProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// GetAddonProperties implements the AddonPropertiesClassification interface for type AddonArcProperties. +func (a *AddonArcProperties) GetAddonProperties() *AddonProperties { + return &AddonProperties{ + AddonType: a.AddonType, + ProvisioningState: a.ProvisioningState, + } +} + // AddonHcxProperties - The properties of an HCX addon type AddonHcxProperties struct { // REQUIRED; The type of private cloud addon @@ -57,7 +78,7 @@ type AddonList struct { // AddonPropertiesClassification provides polymorphic access to related types. // Call the interface's GetAddonProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *AddonHcxProperties, *AddonProperties, *AddonSrmProperties, *AddonVrProperties +// - *AddonArcProperties, *AddonHcxProperties, *AddonProperties, *AddonSrmProperties, *AddonVrProperties type AddonPropertiesClassification interface { // GetAddonProperties returns the AddonProperties content of the underlying type. GetAddonProperties() *AddonProperties @@ -202,12 +223,6 @@ type Circuit struct { SecondarySubnet *string `json:"secondarySubnet,omitempty" azure:"ro"` } -// CloudError - API error response -type CloudError struct { - // An error returned by the API - Error *ErrorResponse `json:"error,omitempty"` -} - // CloudLink - A cloud link resource type CloudLink struct { // The properties of a cloud link. @@ -321,6 +336,21 @@ type ClusterUpdateProperties struct { Hosts []*string `json:"hosts,omitempty"` } +// ClusterZone - Zone and associated hosts info +type ClusterZone struct { + // READ-ONLY; List of hosts belonging to the availability zone in a cluster + Hosts []*string `json:"hosts,omitempty" azure:"ro"` + + // READ-ONLY; Availability zone identifier + Zone *string `json:"zone,omitempty" azure:"ro"` +} + +// ClusterZoneList - List of all zones and associated hosts for a cluster +type ClusterZoneList struct { + // Zone and associated hosts info + Zones []*ClusterZone `json:"zones,omitempty"` +} + // ClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the ClustersClient.BeginCreateOrUpdate method. type ClustersClientBeginCreateOrUpdateOptions struct { // Resumes the LRO from the provided token. @@ -349,6 +379,11 @@ type ClustersClientListOptions struct { // placeholder for future optional parameters } +// ClustersClientListZonesOptions contains the optional parameters for the ClustersClient.ListZones method. +type ClustersClientListZonesOptions struct { + // placeholder for future optional parameters +} + // CommonClusterProperties - The common properties of a cluster type CommonClusterProperties struct { // The cluster size @@ -461,6 +496,9 @@ type EncryptionKeyVaultProperties struct { // The version of the key. KeyVersion *string `json:"keyVersion,omitempty"` + // READ-ONLY; The auto-detected version of the key if versionType is auto-detected. + AutoDetectedKeyVersion *string `json:"autoDetectedKeyVersion,omitempty" azure:"ro"` + // READ-ONLY; The state of key provided KeyState *EncryptionKeyStatus `json:"keyState,omitempty" azure:"ro"` @@ -712,7 +750,8 @@ type LocationsClientCheckQuotaAvailabilityOptions struct { // LocationsClientCheckTrialAvailabilityOptions contains the optional parameters for the LocationsClient.CheckTrialAvailability // method. type LocationsClientCheckTrialAvailabilityOptions struct { - // placeholder for future optional parameters + // The sku to check for trial availability + SKU *SKU } // LogSpecification - Specifications of the Log for Azure Monitoring @@ -973,6 +1012,12 @@ type PlacementPolicyUpdate struct { // PlacementPolicyUpdateProperties - The properties of a placement policy resource that may be updated type PlacementPolicyUpdateProperties struct { + // vm-host placement policy affinity strength (should/must) + AffinityStrength *AffinityStrength `json:"affinityStrength,omitempty"` + + // placement policy azure hybrid benefit opt-in type + AzureHybridBenefitType *AzureHybridBenefitType `json:"azureHybridBenefitType,omitempty"` + // Host members list HostMembers []*string `json:"hostMembers,omitempty"` @@ -1075,6 +1120,10 @@ type PrivateCloudProperties struct { // READ-ONLY; Network used to access vCenter Server and NSX-T Manager ManagementNetwork *string `json:"managementNetwork,omitempty" azure:"ro"` + // READ-ONLY; Flag to indicate whether the private cloud has the quota for provisioned NSX Public IP count raised from 64 + // to 1024 + NsxPublicIPQuotaRaised *NsxPublicIPQuotaRaisedEnum `json:"nsxPublicIpQuotaRaised,omitempty" azure:"ro"` + // READ-ONLY; Thumbprint of the NSX-T Manager SSL certificate NsxtCertificateThumbprint *string `json:"nsxtCertificateThumbprint,omitempty" azure:"ro"` @@ -1401,9 +1450,15 @@ type ScriptPackage struct { // ScriptPackageProperties - Properties of a Script Package subresource type ScriptPackageProperties struct { + // READ-ONLY; Company that created and supports the package + Company *string `json:"company,omitempty" azure:"ro"` + // READ-ONLY; User friendly description of the package Description *string `json:"description,omitempty" azure:"ro"` + // READ-ONLY; Link to support by the package vendor + URI *string `json:"uri,omitempty" azure:"ro"` + // READ-ONLY; Module version Version *string `json:"version,omitempty" azure:"ro"` } @@ -1535,6 +1590,12 @@ type VMHostPlacementPolicyProperties struct { // REQUIRED; Virtual machine members list VMMembers []*string `json:"vmMembers,omitempty"` + // vm-host placement policy affinity strength (should/must) + AffinityStrength *AffinityStrength `json:"affinityStrength,omitempty"` + + // placement policy azure hybrid benefit opt-in type + AzureHybridBenefitType *AzureHybridBenefitType `json:"azureHybridBenefitType,omitempty"` + // Display name of the placement policy DisplayName *string `json:"displayName,omitempty"` @@ -1648,6 +1709,18 @@ type VirtualMachinesList struct { Value []*VirtualMachine `json:"value,omitempty" azure:"ro"` } +// WorkloadNetwork - Workload Network +type WorkloadNetwork struct { + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + // WorkloadNetworkDNSService - NSX DNS Service type WorkloadNetworkDNSService struct { // DNS Service properties @@ -1903,6 +1976,15 @@ type WorkloadNetworkGatewayProperties struct { Path *string `json:"path,omitempty" azure:"ro"` } +// WorkloadNetworkList - A list of workload networks +type WorkloadNetworkList struct { + // READ-ONLY; URL to get the next page if any + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The items on the page + Value []*WorkloadNetwork `json:"value,omitempty" azure:"ro"` +} + // WorkloadNetworkPortMirroring - NSX Port Mirroring type WorkloadNetworkPortMirroring struct { // Port Mirroring Properties. @@ -2289,6 +2371,11 @@ type WorkloadNetworksClientGetGatewayOptions struct { // placeholder for future optional parameters } +// WorkloadNetworksClientGetOptions contains the optional parameters for the WorkloadNetworksClient.Get method. +type WorkloadNetworksClientGetOptions struct { + // placeholder for future optional parameters +} + // WorkloadNetworksClientGetPortMirroringOptions contains the optional parameters for the WorkloadNetworksClient.GetPortMirroring // method. type WorkloadNetworksClientGetPortMirroringOptions struct { @@ -2339,6 +2426,11 @@ type WorkloadNetworksClientListGatewaysOptions struct { // placeholder for future optional parameters } +// WorkloadNetworksClientListOptions contains the optional parameters for the WorkloadNetworksClient.List method. +type WorkloadNetworksClientListOptions struct { + // placeholder for future optional parameters +} + // WorkloadNetworksClientListPortMirroringOptions contains the optional parameters for the WorkloadNetworksClient.ListPortMirroring // method. type WorkloadNetworksClientListPortMirroringOptions struct { diff --git a/sdk/resourcemanager/avs/armavs/models_serde.go b/sdk/resourcemanager/avs/armavs/models_serde.go new file mode 100644 index 000000000000..0ad8edcaf0bd --- /dev/null +++ b/sdk/resourcemanager/avs/armavs/models_serde.go @@ -0,0 +1,4589 @@ +//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. +// DO NOT EDIT. + +package armavs + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Addon. +func (a Addon) 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) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Addon. +func (a *Addon) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + a.Properties, err = unmarshalAddonPropertiesClassification(val) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddonArcProperties. +func (a AddonArcProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["addonType"] = AddonTypeArc + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "vCenter", a.VCenter) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddonArcProperties. +func (a *AddonArcProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addonType": + err = unpopulate(val, "AddonType", &a.AddonType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "vCenter": + err = unpopulate(val, "VCenter", &a.VCenter) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddonHcxProperties. +func (a AddonHcxProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["addonType"] = AddonTypeHCX + populate(objectMap, "offer", a.Offer) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddonHcxProperties. +func (a *AddonHcxProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addonType": + err = unpopulate(val, "AddonType", &a.AddonType) + delete(rawMsg, key) + case "offer": + err = unpopulate(val, "Offer", &a.Offer) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddonList. +func (a AddonList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddonList. +func (a *AddonList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddonProperties. +func (a AddonProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["addonType"] = a.AddonType + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddonProperties. +func (a *AddonProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addonType": + err = unpopulate(val, "AddonType", &a.AddonType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddonSrmProperties. +func (a AddonSrmProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["addonType"] = AddonTypeSRM + populate(objectMap, "licenseKey", a.LicenseKey) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddonSrmProperties. +func (a *AddonSrmProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addonType": + err = unpopulate(val, "AddonType", &a.AddonType) + delete(rawMsg, key) + case "licenseKey": + err = unpopulate(val, "LicenseKey", &a.LicenseKey) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddonVrProperties. +func (a AddonVrProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["addonType"] = AddonTypeVR + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "vrsCount", a.VrsCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddonVrProperties. +func (a *AddonVrProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addonType": + err = unpopulate(val, "AddonType", &a.AddonType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "vrsCount": + err = unpopulate(val, "VrsCount", &a.VrsCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdminCredentials. +func (a AdminCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nsxtPassword", a.NsxtPassword) + populate(objectMap, "nsxtUsername", a.NsxtUsername) + populate(objectMap, "vcenterPassword", a.VcenterPassword) + populate(objectMap, "vcenterUsername", a.VcenterUsername) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdminCredentials. +func (a *AdminCredentials) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nsxtPassword": + err = unpopulate(val, "NsxtPassword", &a.NsxtPassword) + delete(rawMsg, key) + case "nsxtUsername": + err = unpopulate(val, "NsxtUsername", &a.NsxtUsername) + delete(rawMsg, key) + case "vcenterPassword": + err = unpopulate(val, "VcenterPassword", &a.VcenterPassword) + delete(rawMsg, key) + case "vcenterUsername": + err = unpopulate(val, "VcenterUsername", &a.VcenterUsername) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailabilityProperties. +func (a AvailabilityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "secondaryZone", a.SecondaryZone) + populate(objectMap, "strategy", a.Strategy) + populate(objectMap, "zone", a.Zone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityProperties. +func (a *AvailabilityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secondaryZone": + err = unpopulate(val, "SecondaryZone", &a.SecondaryZone) + delete(rawMsg, key) + case "strategy": + err = unpopulate(val, "Strategy", &a.Strategy) + delete(rawMsg, key) + case "zone": + err = unpopulate(val, "Zone", &a.Zone) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Circuit. +func (c Circuit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "expressRouteID", c.ExpressRouteID) + populate(objectMap, "expressRoutePrivatePeeringID", c.ExpressRoutePrivatePeeringID) + populate(objectMap, "primarySubnet", c.PrimarySubnet) + populate(objectMap, "secondarySubnet", c.SecondarySubnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Circuit. +func (c *Circuit) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "expressRouteID": + err = unpopulate(val, "ExpressRouteID", &c.ExpressRouteID) + delete(rawMsg, key) + case "expressRoutePrivatePeeringID": + err = unpopulate(val, "ExpressRoutePrivatePeeringID", &c.ExpressRoutePrivatePeeringID) + delete(rawMsg, key) + case "primarySubnet": + err = unpopulate(val, "PrimarySubnet", &c.PrimarySubnet) + delete(rawMsg, key) + case "secondarySubnet": + err = unpopulate(val, "SecondarySubnet", &c.SecondarySubnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudLink. +func (c CloudLink) 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, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudLink. +func (c *CloudLink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudLinkList. +func (c CloudLinkList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudLinkList. +func (c *CloudLinkList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudLinkProperties. +func (c CloudLinkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "linkedCloud", c.LinkedCloud) + populate(objectMap, "status", c.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudLinkProperties. +func (c *CloudLinkProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "linkedCloud": + err = unpopulate(val, "LinkedCloud", &c.LinkedCloud) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Cluster. +func (c Cluster) 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, "sku", c.SKU) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Cluster. +func (c *Cluster) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterList. +func (c ClusterList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterList. +func (c *ClusterList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterProperties. +func (c ClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clusterId", c.ClusterID) + populate(objectMap, "clusterSize", c.ClusterSize) + populate(objectMap, "hosts", c.Hosts) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterProperties. +func (c *ClusterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterId": + err = unpopulate(val, "ClusterID", &c.ClusterID) + delete(rawMsg, key) + case "clusterSize": + err = unpopulate(val, "ClusterSize", &c.ClusterSize) + delete(rawMsg, key) + case "hosts": + err = unpopulate(val, "Hosts", &c.Hosts) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterUpdate. +func (c ClusterUpdate) 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 ClusterUpdate. +func (c *ClusterUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterUpdateProperties. +func (c ClusterUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clusterSize", c.ClusterSize) + populate(objectMap, "hosts", c.Hosts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterUpdateProperties. +func (c *ClusterUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterSize": + err = unpopulate(val, "ClusterSize", &c.ClusterSize) + delete(rawMsg, key) + case "hosts": + err = unpopulate(val, "Hosts", &c.Hosts) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterZone. +func (c ClusterZone) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hosts", c.Hosts) + populate(objectMap, "zone", c.Zone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterZone. +func (c *ClusterZone) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hosts": + err = unpopulate(val, "Hosts", &c.Hosts) + delete(rawMsg, key) + case "zone": + err = unpopulate(val, "Zone", &c.Zone) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterZoneList. +func (c ClusterZoneList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "zones", c.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterZoneList. +func (c *ClusterZoneList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "zones": + err = unpopulate(val, "Zones", &c.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommonClusterProperties. +func (c CommonClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clusterId", c.ClusterID) + populate(objectMap, "clusterSize", c.ClusterSize) + populate(objectMap, "hosts", c.Hosts) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommonClusterProperties. +func (c *CommonClusterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterId": + err = unpopulate(val, "ClusterID", &c.ClusterID) + delete(rawMsg, key) + case "clusterSize": + err = unpopulate(val, "ClusterSize", &c.ClusterSize) + delete(rawMsg, key) + case "hosts": + err = unpopulate(val, "Hosts", &c.Hosts) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Datastore. +func (d Datastore) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Datastore. +func (d *Datastore) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatastoreList. +func (d DatastoreList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatastoreList. +func (d *DatastoreList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatastoreProperties. +func (d DatastoreProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskPoolVolume", d.DiskPoolVolume) + populate(objectMap, "netAppVolume", d.NetAppVolume) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "status", d.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatastoreProperties. +func (d *DatastoreProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskPoolVolume": + err = unpopulate(val, "DiskPoolVolume", &d.DiskPoolVolume) + delete(rawMsg, key) + case "netAppVolume": + err = unpopulate(val, "NetAppVolume", &d.NetAppVolume) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskPoolVolume. +func (d DiskPoolVolume) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "lunName", d.LunName) + populate(objectMap, "mountOption", d.MountOption) + populate(objectMap, "path", d.Path) + populate(objectMap, "targetId", d.TargetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskPoolVolume. +func (d *DiskPoolVolume) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lunName": + err = unpopulate(val, "LunName", &d.LunName) + delete(rawMsg, key) + case "mountOption": + err = unpopulate(val, "MountOption", &d.MountOption) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &d.Path) + delete(rawMsg, key) + case "targetId": + err = unpopulate(val, "TargetID", &d.TargetID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Encryption. +func (e Encryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyVaultProperties", e.KeyVaultProperties) + populate(objectMap, "status", e.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Encryption. +func (e *Encryption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyVaultProperties": + err = unpopulate(val, "KeyVaultProperties", &e.KeyVaultProperties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncryptionKeyVaultProperties. +func (e EncryptionKeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoDetectedKeyVersion", e.AutoDetectedKeyVersion) + populate(objectMap, "keyName", e.KeyName) + populate(objectMap, "keyState", e.KeyState) + populate(objectMap, "keyVaultUrl", e.KeyVaultURL) + populate(objectMap, "keyVersion", e.KeyVersion) + populate(objectMap, "versionType", e.VersionType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionKeyVaultProperties. +func (e *EncryptionKeyVaultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoDetectedKeyVersion": + err = unpopulate(val, "AutoDetectedKeyVersion", &e.AutoDetectedKeyVersion) + delete(rawMsg, key) + case "keyName": + err = unpopulate(val, "KeyName", &e.KeyName) + delete(rawMsg, key) + case "keyState": + err = unpopulate(val, "KeyState", &e.KeyState) + delete(rawMsg, key) + case "keyVaultUrl": + err = unpopulate(val, "KeyVaultURL", &e.KeyVaultURL) + delete(rawMsg, key) + case "keyVersion": + err = unpopulate(val, "KeyVersion", &e.KeyVersion) + delete(rawMsg, key) + case "versionType": + err = unpopulate(val, "VersionType", &e.VersionType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Endpoints. +func (e Endpoints) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hcxCloudManager", e.HcxCloudManager) + populate(objectMap, "nsxtManager", e.NsxtManager) + populate(objectMap, "vcsa", e.Vcsa) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Endpoints. +func (e *Endpoints) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hcxCloudManager": + err = unpopulate(val, "HcxCloudManager", &e.HcxCloudManager) + delete(rawMsg, key) + case "nsxtManager": + err = unpopulate(val, "NsxtManager", &e.NsxtManager) + delete(rawMsg, key) + case "vcsa": + err = unpopulate(val, "Vcsa", &e.Vcsa) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// 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) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteAuthorization. +func (e ExpressRouteAuthorization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteAuthorization. +func (e *ExpressRouteAuthorization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteAuthorizationList. +func (e ExpressRouteAuthorizationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteAuthorizationList. +func (e *ExpressRouteAuthorizationList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteAuthorizationProperties. +func (e ExpressRouteAuthorizationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "expressRouteAuthorizationId", e.ExpressRouteAuthorizationID) + populate(objectMap, "expressRouteAuthorizationKey", e.ExpressRouteAuthorizationKey) + populate(objectMap, "expressRouteId", e.ExpressRouteID) + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteAuthorizationProperties. +func (e *ExpressRouteAuthorizationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "expressRouteAuthorizationId": + err = unpopulate(val, "ExpressRouteAuthorizationID", &e.ExpressRouteAuthorizationID) + delete(rawMsg, key) + case "expressRouteAuthorizationKey": + err = unpopulate(val, "ExpressRouteAuthorizationKey", &e.ExpressRouteAuthorizationKey) + delete(rawMsg, key) + case "expressRouteId": + err = unpopulate(val, "ExpressRouteID", &e.ExpressRouteID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GlobalReachConnection. +func (g GlobalReachConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalReachConnection. +func (g *GlobalReachConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GlobalReachConnectionList. +func (g GlobalReachConnectionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalReachConnectionList. +func (g *GlobalReachConnectionList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GlobalReachConnectionProperties. +func (g GlobalReachConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefix", g.AddressPrefix) + populate(objectMap, "authorizationKey", g.AuthorizationKey) + populate(objectMap, "circuitConnectionStatus", g.CircuitConnectionStatus) + populate(objectMap, "expressRouteId", g.ExpressRouteID) + populate(objectMap, "peerExpressRouteCircuit", g.PeerExpressRouteCircuit) + populate(objectMap, "provisioningState", g.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalReachConnectionProperties. +func (g *GlobalReachConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &g.AddressPrefix) + delete(rawMsg, key) + case "authorizationKey": + err = unpopulate(val, "AuthorizationKey", &g.AuthorizationKey) + delete(rawMsg, key) + case "circuitConnectionStatus": + err = unpopulate(val, "CircuitConnectionStatus", &g.CircuitConnectionStatus) + delete(rawMsg, key) + case "expressRouteId": + err = unpopulate(val, "ExpressRouteID", &g.ExpressRouteID) + delete(rawMsg, key) + case "peerExpressRouteCircuit": + err = unpopulate(val, "PeerExpressRouteCircuit", &g.PeerExpressRouteCircuit) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HcxEnterpriseSite. +func (h HcxEnterpriseSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HcxEnterpriseSite. +func (h *HcxEnterpriseSite) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HcxEnterpriseSiteList. +func (h HcxEnterpriseSiteList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HcxEnterpriseSiteList. +func (h *HcxEnterpriseSiteList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HcxEnterpriseSiteProperties. +func (h HcxEnterpriseSiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "activationKey", h.ActivationKey) + populate(objectMap, "status", h.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HcxEnterpriseSiteProperties. +func (h *HcxEnterpriseSiteProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activationKey": + err = unpopulate(val, "ActivationKey", &h.ActivationKey) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &h.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IdentitySource. +func (i IdentitySource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alias", i.Alias) + populate(objectMap, "baseGroupDN", i.BaseGroupDN) + populate(objectMap, "baseUserDN", i.BaseUserDN) + populate(objectMap, "domain", i.Domain) + populate(objectMap, "name", i.Name) + populate(objectMap, "password", i.Password) + populate(objectMap, "primaryServer", i.PrimaryServer) + populate(objectMap, "ssl", i.SSL) + populate(objectMap, "secondaryServer", i.SecondaryServer) + populate(objectMap, "username", i.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentitySource. +func (i *IdentitySource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alias": + err = unpopulate(val, "Alias", &i.Alias) + delete(rawMsg, key) + case "baseGroupDN": + err = unpopulate(val, "BaseGroupDN", &i.BaseGroupDN) + delete(rawMsg, key) + case "baseUserDN": + err = unpopulate(val, "BaseUserDN", &i.BaseUserDN) + delete(rawMsg, key) + case "domain": + err = unpopulate(val, "Domain", &i.Domain) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &i.Password) + delete(rawMsg, key) + case "primaryServer": + err = unpopulate(val, "PrimaryServer", &i.PrimaryServer) + delete(rawMsg, key) + case "ssl": + err = unpopulate(val, "SSL", &i.SSL) + delete(rawMsg, key) + case "secondaryServer": + err = unpopulate(val, "SecondaryServer", &i.SecondaryServer) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &i.Username) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogSpecification. +func (l LogSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blobDuration", l.BlobDuration) + populate(objectMap, "displayName", l.DisplayName) + populate(objectMap, "name", l.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogSpecification. +func (l *LogSpecification) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobDuration": + err = unpopulate(val, "BlobDuration", &l.BlobDuration) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &l.DisplayName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementCluster. +func (m ManagementCluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clusterId", m.ClusterID) + populate(objectMap, "clusterSize", m.ClusterSize) + populate(objectMap, "hosts", m.Hosts) + populate(objectMap, "provisioningState", m.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementCluster. +func (m *ManagementCluster) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterId": + err = unpopulate(val, "ClusterID", &m.ClusterID) + delete(rawMsg, key) + case "clusterSize": + err = unpopulate(val, "ClusterSize", &m.ClusterSize) + delete(rawMsg, key) + case "hosts": + err = unpopulate(val, "Hosts", &m.Hosts) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricDimension. +func (m MetricDimension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "internalName", m.InternalName) + populate(objectMap, "name", m.Name) + populate(objectMap, "toBeExportedForShoebox", m.ToBeExportedForShoebox) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricDimension. +func (m *MetricDimension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "internalName": + err = unpopulate(val, "InternalName", &m.InternalName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "toBeExportedForShoebox": + err = unpopulate(val, "ToBeExportedForShoebox", &m.ToBeExportedForShoebox) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// 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, "enableRegionalMdmAccount", m.EnableRegionalMdmAccount) + populate(objectMap, "fillGapWithZero", m.FillGapWithZero) + 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) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricSpecification. +func (m *MetricSpecification) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregationType": + err = unpopulate(val, "AggregationType", &m.AggregationType) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &m.Category) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &m.Dimensions) + delete(rawMsg, key) + case "displayDescription": + err = unpopulate(val, "DisplayDescription", &m.DisplayDescription) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "enableRegionalMdmAccount": + err = unpopulate(val, "EnableRegionalMdmAccount", &m.EnableRegionalMdmAccount) + delete(rawMsg, key) + case "fillGapWithZero": + err = unpopulate(val, "FillGapWithZero", &m.FillGapWithZero) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "sourceMdmAccount": + err = unpopulate(val, "SourceMdmAccount", &m.SourceMdmAccount) + delete(rawMsg, key) + case "sourceMdmNamespace": + err = unpopulate(val, "SourceMdmNamespace", &m.SourceMdmNamespace) + delete(rawMsg, key) + case "supportedAggregationTypes": + err = unpopulate(val, "SupportedAggregationTypes", &m.SupportedAggregationTypes) + delete(rawMsg, key) + case "supportedTimeGrainTypes": + err = unpopulate(val, "SupportedTimeGrainTypes", &m.SupportedTimeGrainTypes) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &m.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetAppVolume. +func (n NetAppVolume) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", n.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetAppVolume. +func (n *NetAppVolume) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, 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, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// 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) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationList. +func (o *OperationList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationProperties. +func (o OperationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "serviceSpecification", o.ServiceSpecification) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationProperties. +func (o *OperationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "serviceSpecification": + err = unpopulate(val, "ServiceSpecification", &o.ServiceSpecification) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PSCredentialExecutionParameter. +func (p PSCredentialExecutionParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", p.Name) + populate(objectMap, "password", p.Password) + objectMap["type"] = ScriptExecutionParameterTypeCredential + populate(objectMap, "username", p.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PSCredentialExecutionParameter. +func (p *PSCredentialExecutionParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &p.Password) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &p.Username) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PlacementPoliciesList. +func (p PlacementPoliciesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlacementPoliciesList. +func (p *PlacementPoliciesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PlacementPolicy. +func (p PlacementPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlacementPolicy. +func (p *PlacementPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + p.Properties, err = unmarshalPlacementPolicyPropertiesClassification(val) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PlacementPolicyProperties. +func (p PlacementPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "state", p.State) + objectMap["type"] = p.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlacementPolicyProperties. +func (p *PlacementPolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PlacementPolicyUpdate. +func (p PlacementPolicyUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlacementPolicyUpdate. +func (p *PlacementPolicyUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PlacementPolicyUpdateProperties. +func (p PlacementPolicyUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "affinityStrength", p.AffinityStrength) + populate(objectMap, "azureHybridBenefitType", p.AzureHybridBenefitType) + populate(objectMap, "hostMembers", p.HostMembers) + populate(objectMap, "state", p.State) + populate(objectMap, "vmMembers", p.VMMembers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlacementPolicyUpdateProperties. +func (p *PlacementPolicyUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "affinityStrength": + err = unpopulate(val, "AffinityStrength", &p.AffinityStrength) + delete(rawMsg, key) + case "azureHybridBenefitType": + err = unpopulate(val, "AzureHybridBenefitType", &p.AzureHybridBenefitType) + delete(rawMsg, key) + case "hostMembers": + err = unpopulate(val, "HostMembers", &p.HostMembers) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + case "vmMembers": + err = unpopulate(val, "VMMembers", &p.VMMembers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateCloud. +func (p PrivateCloud) 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, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateCloud. +func (p *PrivateCloud) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &p.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &p.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateCloudIdentity. +func (p PrivateCloudIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", p.PrincipalID) + populate(objectMap, "tenantId", p.TenantID) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateCloudIdentity. +func (p *PrivateCloudIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &p.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &p.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateCloudList. +func (p PrivateCloudList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateCloudList. +func (p *PrivateCloudList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateCloudProperties. +func (p PrivateCloudProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availability", p.Availability) + populate(objectMap, "circuit", p.Circuit) + populate(objectMap, "encryption", p.Encryption) + populate(objectMap, "endpoints", p.Endpoints) + populate(objectMap, "externalCloudLinks", p.ExternalCloudLinks) + populate(objectMap, "identitySources", p.IdentitySources) + populate(objectMap, "internet", p.Internet) + populate(objectMap, "managementCluster", p.ManagementCluster) + populate(objectMap, "managementNetwork", p.ManagementNetwork) + populate(objectMap, "networkBlock", p.NetworkBlock) + populate(objectMap, "nsxPublicIpQuotaRaised", p.NsxPublicIPQuotaRaised) + populate(objectMap, "nsxtCertificateThumbprint", p.NsxtCertificateThumbprint) + populate(objectMap, "nsxtPassword", p.NsxtPassword) + populate(objectMap, "provisioningNetwork", p.ProvisioningNetwork) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "secondaryCircuit", p.SecondaryCircuit) + populate(objectMap, "vcenterCertificateThumbprint", p.VcenterCertificateThumbprint) + populate(objectMap, "vcenterPassword", p.VcenterPassword) + populate(objectMap, "vmotionNetwork", p.VmotionNetwork) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateCloudProperties. +func (p *PrivateCloudProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availability": + err = unpopulate(val, "Availability", &p.Availability) + delete(rawMsg, key) + case "circuit": + err = unpopulate(val, "Circuit", &p.Circuit) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &p.Encryption) + delete(rawMsg, key) + case "endpoints": + err = unpopulate(val, "Endpoints", &p.Endpoints) + delete(rawMsg, key) + case "externalCloudLinks": + err = unpopulate(val, "ExternalCloudLinks", &p.ExternalCloudLinks) + delete(rawMsg, key) + case "identitySources": + err = unpopulate(val, "IdentitySources", &p.IdentitySources) + delete(rawMsg, key) + case "internet": + err = unpopulate(val, "Internet", &p.Internet) + delete(rawMsg, key) + case "managementCluster": + err = unpopulate(val, "ManagementCluster", &p.ManagementCluster) + delete(rawMsg, key) + case "managementNetwork": + err = unpopulate(val, "ManagementNetwork", &p.ManagementNetwork) + delete(rawMsg, key) + case "networkBlock": + err = unpopulate(val, "NetworkBlock", &p.NetworkBlock) + delete(rawMsg, key) + case "nsxPublicIpQuotaRaised": + err = unpopulate(val, "NsxPublicIPQuotaRaised", &p.NsxPublicIPQuotaRaised) + delete(rawMsg, key) + case "nsxtCertificateThumbprint": + err = unpopulate(val, "NsxtCertificateThumbprint", &p.NsxtCertificateThumbprint) + delete(rawMsg, key) + case "nsxtPassword": + err = unpopulate(val, "NsxtPassword", &p.NsxtPassword) + delete(rawMsg, key) + case "provisioningNetwork": + err = unpopulate(val, "ProvisioningNetwork", &p.ProvisioningNetwork) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "secondaryCircuit": + err = unpopulate(val, "SecondaryCircuit", &p.SecondaryCircuit) + delete(rawMsg, key) + case "vcenterCertificateThumbprint": + err = unpopulate(val, "VcenterCertificateThumbprint", &p.VcenterCertificateThumbprint) + delete(rawMsg, key) + case "vcenterPassword": + err = unpopulate(val, "VcenterPassword", &p.VcenterPassword) + delete(rawMsg, key) + case "vmotionNetwork": + err = unpopulate(val, "VmotionNetwork", &p.VmotionNetwork) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateCloudUpdate. +func (p PrivateCloudUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", p.Identity) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateCloudUpdate. +func (p *PrivateCloudUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &p.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateCloudUpdateProperties. +func (p PrivateCloudUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availability", p.Availability) + populate(objectMap, "encryption", p.Encryption) + populate(objectMap, "identitySources", p.IdentitySources) + populate(objectMap, "internet", p.Internet) + populate(objectMap, "managementCluster", p.ManagementCluster) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateCloudUpdateProperties. +func (p *PrivateCloudUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availability": + err = unpopulate(val, "Availability", &p.Availability) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &p.Encryption) + delete(rawMsg, key) + case "identitySources": + err = unpopulate(val, "IdentitySources", &p.IdentitySources) + delete(rawMsg, key) + case "internet": + err = unpopulate(val, "Internet", &p.Internet) + delete(rawMsg, key) + case "managementCluster": + err = unpopulate(val, "ManagementCluster", &p.ManagementCluster) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Quota. +func (q Quota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hostsRemaining", q.HostsRemaining) + populate(objectMap, "quotaEnabled", q.QuotaEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Quota. +func (q *Quota) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hostsRemaining": + err = unpopulate(val, "HostsRemaining", &q.HostsRemaining) + delete(rawMsg, key) + case "quotaEnabled": + err = unpopulate(val, "QuotaEnabled", &q.QuotaEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKU. +func (s SKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. +func (s *SKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptCmdlet. +func (s ScriptCmdlet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptCmdlet. +func (s *ScriptCmdlet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptCmdletProperties. +func (s ScriptCmdletProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", s.Description) + populate(objectMap, "parameters", s.Parameters) + populate(objectMap, "timeout", s.Timeout) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptCmdletProperties. +func (s *ScriptCmdletProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &s.Parameters) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &s.Timeout) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptCmdletsList. +func (s ScriptCmdletsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptCmdletsList. +func (s *ScriptCmdletsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptExecution. +func (s ScriptExecution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptExecution. +func (s *ScriptExecution) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptExecutionParameter. +func (s ScriptExecutionParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + objectMap["type"] = s.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptExecutionParameter. +func (s *ScriptExecutionParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptExecutionProperties. +func (s ScriptExecutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errors", s.Errors) + populate(objectMap, "failureReason", s.FailureReason) + populateTimeRFC3339(objectMap, "finishedAt", s.FinishedAt) + populate(objectMap, "hiddenParameters", s.HiddenParameters) + populate(objectMap, "information", s.Information) + populate(objectMap, "namedOutputs", s.NamedOutputs) + populate(objectMap, "output", s.Output) + populate(objectMap, "parameters", s.Parameters) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "retention", s.Retention) + populate(objectMap, "scriptCmdletId", s.ScriptCmdletID) + populateTimeRFC3339(objectMap, "startedAt", s.StartedAt) + populateTimeRFC3339(objectMap, "submittedAt", s.SubmittedAt) + populate(objectMap, "timeout", s.Timeout) + populate(objectMap, "warnings", s.Warnings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptExecutionProperties. +func (s *ScriptExecutionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errors": + err = unpopulate(val, "Errors", &s.Errors) + delete(rawMsg, key) + case "failureReason": + err = unpopulate(val, "FailureReason", &s.FailureReason) + delete(rawMsg, key) + case "finishedAt": + err = unpopulateTimeRFC3339(val, "FinishedAt", &s.FinishedAt) + delete(rawMsg, key) + case "hiddenParameters": + s.HiddenParameters, err = unmarshalScriptExecutionParameterClassificationArray(val) + delete(rawMsg, key) + case "information": + err = unpopulate(val, "Information", &s.Information) + delete(rawMsg, key) + case "namedOutputs": + err = unpopulate(val, "NamedOutputs", &s.NamedOutputs) + delete(rawMsg, key) + case "output": + err = unpopulate(val, "Output", &s.Output) + delete(rawMsg, key) + case "parameters": + s.Parameters, err = unmarshalScriptExecutionParameterClassificationArray(val) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "retention": + err = unpopulate(val, "Retention", &s.Retention) + delete(rawMsg, key) + case "scriptCmdletId": + err = unpopulate(val, "ScriptCmdletID", &s.ScriptCmdletID) + delete(rawMsg, key) + case "startedAt": + err = unpopulateTimeRFC3339(val, "StartedAt", &s.StartedAt) + delete(rawMsg, key) + case "submittedAt": + err = unpopulateTimeRFC3339(val, "SubmittedAt", &s.SubmittedAt) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &s.Timeout) + delete(rawMsg, key) + case "warnings": + err = unpopulate(val, "Warnings", &s.Warnings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptExecutionsList. +func (s ScriptExecutionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptExecutionsList. +func (s *ScriptExecutionsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptPackage. +func (s ScriptPackage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptPackage. +func (s *ScriptPackage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptPackageProperties. +func (s ScriptPackageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "company", s.Company) + populate(objectMap, "description", s.Description) + populate(objectMap, "uri", s.URI) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptPackageProperties. +func (s *ScriptPackageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "company": + err = unpopulate(val, "Company", &s.Company) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &s.URI) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptPackagesList. +func (s ScriptPackagesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptPackagesList. +func (s *ScriptPackagesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptParameter. +func (s ScriptParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", s.Description) + populate(objectMap, "name", s.Name) + populate(objectMap, "optional", s.Optional) + populate(objectMap, "type", s.Type) + populate(objectMap, "visibility", s.Visibility) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptParameter. +func (s *ScriptParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "optional": + err = unpopulate(val, "Optional", &s.Optional) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + case "visibility": + err = unpopulate(val, "Visibility", &s.Visibility) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptSecureStringExecutionParameter. +func (s ScriptSecureStringExecutionParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + populate(objectMap, "secureValue", s.SecureValue) + objectMap["type"] = ScriptExecutionParameterTypeSecureValue + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptSecureStringExecutionParameter. +func (s *ScriptSecureStringExecutionParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "secureValue": + err = unpopulate(val, "SecureValue", &s.SecureValue) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptStringExecutionParameter. +func (s ScriptStringExecutionParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + objectMap["type"] = ScriptExecutionParameterTypeValue + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptStringExecutionParameter. +func (s *ScriptStringExecutionParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, 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) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceSpecification. +func (s *ServiceSpecification) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logSpecifications": + err = unpopulate(val, "LogSpecifications", &s.LogSpecifications) + delete(rawMsg, key) + case "metricSpecifications": + err = unpopulate(val, "MetricSpecifications", &s.MetricSpecifications) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, 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) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Trial. +func (t Trial) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availableHosts", t.AvailableHosts) + populate(objectMap, "status", t.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Trial. +func (t *Trial) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availableHosts": + err = unpopulate(val, "AvailableHosts", &t.AvailableHosts) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMHostPlacementPolicyProperties. +func (v VMHostPlacementPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "affinityStrength", v.AffinityStrength) + populate(objectMap, "affinityType", v.AffinityType) + populate(objectMap, "azureHybridBenefitType", v.AzureHybridBenefitType) + populate(objectMap, "displayName", v.DisplayName) + populate(objectMap, "hostMembers", v.HostMembers) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "state", v.State) + objectMap["type"] = PlacementPolicyTypeVMHost + populate(objectMap, "vmMembers", v.VMMembers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMHostPlacementPolicyProperties. +func (v *VMHostPlacementPolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "affinityStrength": + err = unpopulate(val, "AffinityStrength", &v.AffinityStrength) + delete(rawMsg, key) + case "affinityType": + err = unpopulate(val, "AffinityType", &v.AffinityType) + delete(rawMsg, key) + case "azureHybridBenefitType": + err = unpopulate(val, "AzureHybridBenefitType", &v.AzureHybridBenefitType) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &v.DisplayName) + delete(rawMsg, key) + case "hostMembers": + err = unpopulate(val, "HostMembers", &v.HostMembers) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &v.State) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "vmMembers": + err = unpopulate(val, "VMMembers", &v.VMMembers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMPlacementPolicyProperties. +func (v VMPlacementPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "affinityType", v.AffinityType) + populate(objectMap, "displayName", v.DisplayName) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "state", v.State) + objectMap["type"] = PlacementPolicyTypeVMVM + populate(objectMap, "vmMembers", v.VMMembers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMPlacementPolicyProperties. +func (v *VMPlacementPolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "affinityType": + err = unpopulate(val, "AffinityType", &v.AffinityType) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &v.DisplayName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &v.State) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "vmMembers": + err = unpopulate(val, "VMMembers", &v.VMMembers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachine. +func (v VirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + 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 fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineProperties. +func (v VirtualMachineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", v.DisplayName) + populate(objectMap, "folderPath", v.FolderPath) + populate(objectMap, "moRefId", v.MoRefID) + populate(objectMap, "restrictMovement", v.RestrictMovement) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineProperties. +func (v *VirtualMachineProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &v.DisplayName) + delete(rawMsg, key) + case "folderPath": + err = unpopulate(val, "FolderPath", &v.FolderPath) + delete(rawMsg, key) + case "moRefId": + err = unpopulate(val, "MoRefID", &v.MoRefID) + delete(rawMsg, key) + case "restrictMovement": + err = unpopulate(val, "RestrictMovement", &v.RestrictMovement) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineRestrictMovement. +func (v VirtualMachineRestrictMovement) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "restrictMovement", v.RestrictMovement) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineRestrictMovement. +func (v *VirtualMachineRestrictMovement) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "restrictMovement": + err = unpopulate(val, "RestrictMovement", &v.RestrictMovement) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachinesList. +func (v VirtualMachinesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachinesList. +func (v *VirtualMachinesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetwork. +func (w WorkloadNetwork) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetwork. +func (w *WorkloadNetwork) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDNSService. +func (w WorkloadNetworkDNSService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDNSService. +func (w *WorkloadNetworkDNSService) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDNSServiceProperties. +func (w WorkloadNetworkDNSServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsServiceIp", w.DNSServiceIP) + populate(objectMap, "defaultDnsZone", w.DefaultDNSZone) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "fqdnZones", w.FqdnZones) + populate(objectMap, "logLevel", w.LogLevel) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "revision", w.Revision) + populate(objectMap, "status", w.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDNSServiceProperties. +func (w *WorkloadNetworkDNSServiceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsServiceIp": + err = unpopulate(val, "DNSServiceIP", &w.DNSServiceIP) + delete(rawMsg, key) + case "defaultDnsZone": + err = unpopulate(val, "DefaultDNSZone", &w.DefaultDNSZone) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "fqdnZones": + err = unpopulate(val, "FqdnZones", &w.FqdnZones) + delete(rawMsg, key) + case "logLevel": + err = unpopulate(val, "LogLevel", &w.LogLevel) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &w.Revision) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &w.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDNSServicesList. +func (w WorkloadNetworkDNSServicesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDNSServicesList. +func (w *WorkloadNetworkDNSServicesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDNSZone. +func (w WorkloadNetworkDNSZone) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDNSZone. +func (w *WorkloadNetworkDNSZone) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDNSZoneProperties. +func (w WorkloadNetworkDNSZoneProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsServerIps", w.DNSServerIPs) + populate(objectMap, "dnsServices", w.DNSServices) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "domain", w.Domain) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "revision", w.Revision) + populate(objectMap, "sourceIp", w.SourceIP) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDNSZoneProperties. +func (w *WorkloadNetworkDNSZoneProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsServerIps": + err = unpopulate(val, "DNSServerIPs", &w.DNSServerIPs) + delete(rawMsg, key) + case "dnsServices": + err = unpopulate(val, "DNSServices", &w.DNSServices) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "domain": + err = unpopulate(val, "Domain", &w.Domain) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &w.Revision) + delete(rawMsg, key) + case "sourceIp": + err = unpopulate(val, "SourceIP", &w.SourceIP) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDNSZonesList. +func (w WorkloadNetworkDNSZonesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDNSZonesList. +func (w *WorkloadNetworkDNSZonesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDhcp. +func (w WorkloadNetworkDhcp) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDhcp. +func (w *WorkloadNetworkDhcp) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + w.Properties, err = unmarshalWorkloadNetworkDhcpEntityClassification(val) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDhcpEntity. +func (w WorkloadNetworkDhcpEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["dhcpType"] = w.DhcpType + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "revision", w.Revision) + populate(objectMap, "segments", w.Segments) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDhcpEntity. +func (w *WorkloadNetworkDhcpEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dhcpType": + err = unpopulate(val, "DhcpType", &w.DhcpType) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &w.Revision) + delete(rawMsg, key) + case "segments": + err = unpopulate(val, "Segments", &w.Segments) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDhcpList. +func (w WorkloadNetworkDhcpList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDhcpList. +func (w *WorkloadNetworkDhcpList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDhcpRelay. +func (w WorkloadNetworkDhcpRelay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["dhcpType"] = DhcpTypeEnumRELAY + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "revision", w.Revision) + populate(objectMap, "segments", w.Segments) + populate(objectMap, "serverAddresses", w.ServerAddresses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDhcpRelay. +func (w *WorkloadNetworkDhcpRelay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dhcpType": + err = unpopulate(val, "DhcpType", &w.DhcpType) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &w.Revision) + delete(rawMsg, key) + case "segments": + err = unpopulate(val, "Segments", &w.Segments) + delete(rawMsg, key) + case "serverAddresses": + err = unpopulate(val, "ServerAddresses", &w.ServerAddresses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDhcpServer. +func (w WorkloadNetworkDhcpServer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["dhcpType"] = DhcpTypeEnumSERVER + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "leaseTime", w.LeaseTime) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "revision", w.Revision) + populate(objectMap, "segments", w.Segments) + populate(objectMap, "serverAddress", w.ServerAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDhcpServer. +func (w *WorkloadNetworkDhcpServer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dhcpType": + err = unpopulate(val, "DhcpType", &w.DhcpType) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "leaseTime": + err = unpopulate(val, "LeaseTime", &w.LeaseTime) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &w.Revision) + delete(rawMsg, key) + case "segments": + err = unpopulate(val, "Segments", &w.Segments) + delete(rawMsg, key) + case "serverAddress": + err = unpopulate(val, "ServerAddress", &w.ServerAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkGateway. +func (w WorkloadNetworkGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkGateway. +func (w *WorkloadNetworkGateway) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkGatewayList. +func (w WorkloadNetworkGatewayList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkGatewayList. +func (w *WorkloadNetworkGatewayList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkGatewayProperties. +func (w WorkloadNetworkGatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "path", w.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkGatewayProperties. +func (w *WorkloadNetworkGatewayProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &w.Path) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkList. +func (w WorkloadNetworkList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkList. +func (w *WorkloadNetworkList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkPortMirroring. +func (w WorkloadNetworkPortMirroring) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkPortMirroring. +func (w *WorkloadNetworkPortMirroring) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkPortMirroringList. +func (w WorkloadNetworkPortMirroringList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkPortMirroringList. +func (w *WorkloadNetworkPortMirroringList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkPortMirroringProperties. +func (w WorkloadNetworkPortMirroringProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destination", w.Destination) + populate(objectMap, "direction", w.Direction) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "revision", w.Revision) + populate(objectMap, "source", w.Source) + populate(objectMap, "status", w.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkPortMirroringProperties. +func (w *WorkloadNetworkPortMirroringProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destination": + err = unpopulate(val, "Destination", &w.Destination) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &w.Direction) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &w.Revision) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &w.Source) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &w.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkPublicIP. +func (w WorkloadNetworkPublicIP) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkPublicIP. +func (w *WorkloadNetworkPublicIP) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkPublicIPProperties. +func (w WorkloadNetworkPublicIPProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "numberOfPublicIPs", w.NumberOfPublicIPs) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "publicIPBlock", w.PublicIPBlock) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkPublicIPProperties. +func (w *WorkloadNetworkPublicIPProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "numberOfPublicIPs": + err = unpopulate(val, "NumberOfPublicIPs", &w.NumberOfPublicIPs) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "publicIPBlock": + err = unpopulate(val, "PublicIPBlock", &w.PublicIPBlock) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkPublicIPsList. +func (w WorkloadNetworkPublicIPsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkPublicIPsList. +func (w *WorkloadNetworkPublicIPsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkSegment. +func (w WorkloadNetworkSegment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkSegment. +func (w *WorkloadNetworkSegment) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkSegmentPortVif. +func (w WorkloadNetworkSegmentPortVif) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "portName", w.PortName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkSegmentPortVif. +func (w *WorkloadNetworkSegmentPortVif) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "portName": + err = unpopulate(val, "PortName", &w.PortName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkSegmentProperties. +func (w WorkloadNetworkSegmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectedGateway", w.ConnectedGateway) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "portVif", w.PortVif) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "revision", w.Revision) + populate(objectMap, "status", w.Status) + populate(objectMap, "subnet", w.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkSegmentProperties. +func (w *WorkloadNetworkSegmentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectedGateway": + err = unpopulate(val, "ConnectedGateway", &w.ConnectedGateway) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "portVif": + err = unpopulate(val, "PortVif", &w.PortVif) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &w.Revision) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &w.Status) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &w.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkSegmentSubnet. +func (w WorkloadNetworkSegmentSubnet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dhcpRanges", w.DhcpRanges) + populate(objectMap, "gatewayAddress", w.GatewayAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkSegmentSubnet. +func (w *WorkloadNetworkSegmentSubnet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dhcpRanges": + err = unpopulate(val, "DhcpRanges", &w.DhcpRanges) + delete(rawMsg, key) + case "gatewayAddress": + err = unpopulate(val, "GatewayAddress", &w.GatewayAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkSegmentsList. +func (w WorkloadNetworkSegmentsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkSegmentsList. +func (w *WorkloadNetworkSegmentsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkVMGroup. +func (w WorkloadNetworkVMGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkVMGroup. +func (w *WorkloadNetworkVMGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkVMGroupProperties. +func (w WorkloadNetworkVMGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "members", w.Members) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "revision", w.Revision) + populate(objectMap, "status", w.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkVMGroupProperties. +func (w *WorkloadNetworkVMGroupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "members": + err = unpopulate(val, "Members", &w.Members) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &w.Revision) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &w.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkVMGroupsList. +func (w WorkloadNetworkVMGroupsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkVMGroupsList. +func (w *WorkloadNetworkVMGroupsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkVirtualMachine. +func (w WorkloadNetworkVirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkVirtualMachine. +func (w *WorkloadNetworkVirtualMachine) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkVirtualMachineProperties. +func (w WorkloadNetworkVirtualMachineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "vmType", w.VMType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkVirtualMachineProperties. +func (w *WorkloadNetworkVirtualMachineProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "vmType": + err = unpopulate(val, "VMType", &w.VMType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkVirtualMachinesList. +func (w WorkloadNetworkVirtualMachinesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkVirtualMachinesList. +func (w *WorkloadNetworkVirtualMachinesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, 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, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_operations_client.go b/sdk/resourcemanager/avs/armavs/operations_client.go similarity index 96% rename from sdk/resourcemanager/avs/armavs/zz_generated_operations_client.go rename to sdk/resourcemanager/avs/armavs/operations_client.go index d3e5db80d50b..a121f977b5f0 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_operations_client.go +++ b/sdk/resourcemanager/avs/armavs/operations_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -49,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available operations -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/avs/armavs/operations_client_example_test.go similarity index 95% rename from sdk/resourcemanager/avs/armavs/ze_generated_example_operations_client_test.go rename to sdk/resourcemanager/avs/armavs/operations_client_example_test.go index 39f3296bae6a..9f658b0307e5 100644 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/avs/armavs/operations_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Operations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_placementpolicies_client.go b/sdk/resourcemanager/avs/armavs/placementpolicies_client.go similarity index 97% rename from sdk/resourcemanager/avs/armavs/zz_generated_placementpolicies_client.go rename to sdk/resourcemanager/avs/armavs/placementpolicies_client.go index 417375450387..144a6578cd09 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_placementpolicies_client.go +++ b/sdk/resourcemanager/avs/armavs/placementpolicies_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewPlacementPoliciesClient(subscriptionID string, credential azcore.TokenCr // BeginCreateOrUpdate - Create or update a placement policy in a private cloud cluster // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -78,7 +79,7 @@ func (client *PlacementPoliciesClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Create or update a placement policy in a private cloud cluster // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *PlacementPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, placementPolicyName string, placementPolicy PlacementPolicy, options *PlacementPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicy, options) if err != nil { @@ -122,7 +123,7 @@ func (client *PlacementPoliciesClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, placementPolicy) @@ -130,7 +131,7 @@ func (client *PlacementPoliciesClient) createOrUpdateCreateRequest(ctx context.C // BeginDelete - Delete a placement policy in a private cloud cluster // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -151,7 +152,7 @@ func (client *PlacementPoliciesClient) BeginDelete(ctx context.Context, resource // Delete - Delete a placement policy in a private cloud cluster // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *PlacementPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, placementPolicyName string, options *PlacementPoliciesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateCloudName, clusterName, placementPolicyName, options) if err != nil { @@ -195,7 +196,7 @@ func (client *PlacementPoliciesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -203,7 +204,7 @@ func (client *PlacementPoliciesClient) deleteCreateRequest(ctx context.Context, // Get - Get a placement policy by name in a private cloud cluster // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -252,7 +253,7 @@ func (client *PlacementPoliciesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -268,8 +269,7 @@ func (client *PlacementPoliciesClient) getHandleResponse(resp *http.Response) (P } // NewListPager - List placement policies in a private cloud cluster -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -326,7 +326,7 @@ func (client *PlacementPoliciesClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -343,7 +343,7 @@ func (client *PlacementPoliciesClient) listHandleResponse(resp *http.Response) ( // BeginUpdate - Update a placement policy in a private cloud cluster // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -365,7 +365,7 @@ func (client *PlacementPoliciesClient) BeginUpdate(ctx context.Context, resource // Update - Update a placement policy in a private cloud cluster // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *PlacementPoliciesClient) update(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, placementPolicyName string, placementPolicyUpdate PlacementPolicyUpdate, options *PlacementPoliciesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicyUpdate, options) if err != nil { @@ -409,7 +409,7 @@ func (client *PlacementPoliciesClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, placementPolicyUpdate) diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_placementpolicies_client_test.go b/sdk/resourcemanager/avs/armavs/placementpolicies_client_example_test.go similarity index 55% rename from sdk/resourcemanager/avs/armavs/ze_generated_example_placementpolicies_client_test.go rename to sdk/resourcemanager/avs/armavs/placementpolicies_client_example_test.go index d458b46999c0..1d7b3ff6b168 100644 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_placementpolicies_client_test.go +++ b/sdk/resourcemanager/avs/armavs/placementpolicies_client_example_test.go @@ -17,21 +17,18 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PlacementPolicies_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PlacementPolicies_List.json func ExamplePlacementPoliciesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPlacementPoliciesClient("{subscription-id}", cred, nil) + client, err := armavs.NewPlacementPoliciesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("group1", - "cloud1", - "cluster1", - nil) + pager := client.NewListPager("group1", "cloud1", "cluster1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -44,23 +41,18 @@ func ExamplePlacementPoliciesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PlacementPolicies_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PlacementPolicies_Get.json func ExamplePlacementPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPlacementPoliciesClient("{subscription-id}", cred, nil) + client, err := armavs.NewPlacementPoliciesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "group1", - "cloud1", - "cluster1", - "policy1", - nil) + res, err := client.Get(ctx, "group1", "cloud1", "cluster1", "policy1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -68,36 +60,32 @@ func ExamplePlacementPoliciesClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PlacementPolicies_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PlacementPolicies_CreateOrUpdate.json func ExamplePlacementPoliciesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPlacementPoliciesClient("{subscription-id}", cred, nil) + client, err := armavs.NewPlacementPoliciesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "group1", - "cloud1", - "cluster1", - "policy1", - armavs.PlacementPolicy{ - Properties: &armavs.VMHostPlacementPolicyProperties{ - Type: to.Ptr(armavs.PlacementPolicyTypeVMHost), - AffinityType: to.Ptr(armavs.AffinityTypeAntiAffinity), - HostMembers: []*string{ - to.Ptr("fakehost22.nyc1.kubernetes.center"), - to.Ptr("fakehost23.nyc1.kubernetes.center"), - to.Ptr("fakehost24.nyc1.kubernetes.center")}, - VMMembers: []*string{ - to.Ptr("/subscriptions/{subscription-id}/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), - to.Ptr("/subscriptions/{subscription-id}/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-256")}, - }, + poller, err := client.BeginCreateOrUpdate(ctx, "group1", "cloud1", "cluster1", "policy1", armavs.PlacementPolicy{ + Properties: &armavs.VMHostPlacementPolicyProperties{ + Type: to.Ptr(armavs.PlacementPolicyTypeVMHost), + AffinityStrength: to.Ptr(armavs.AffinityStrengthMust), + AffinityType: to.Ptr(armavs.AffinityTypeAntiAffinity), + AzureHybridBenefitType: to.Ptr(armavs.AzureHybridBenefitTypeSQLHost), + HostMembers: []*string{ + to.Ptr("fakehost22.nyc1.kubernetes.center"), + to.Ptr("fakehost23.nyc1.kubernetes.center"), + to.Ptr("fakehost24.nyc1.kubernetes.center")}, + VMMembers: []*string{ + to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), + to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-256")}, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -109,35 +97,31 @@ func ExamplePlacementPoliciesClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PlacementPolicies_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PlacementPolicies_Update.json func ExamplePlacementPoliciesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPlacementPoliciesClient("{subscription-id}", cred, nil) + client, err := armavs.NewPlacementPoliciesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "group1", - "cloud1", - "cluster1", - "policy1", - armavs.PlacementPolicyUpdate{ - Properties: &armavs.PlacementPolicyUpdateProperties{ - HostMembers: []*string{ - to.Ptr("fakehost22.nyc1.kubernetes.center"), - to.Ptr("fakehost23.nyc1.kubernetes.center"), - to.Ptr("fakehost24.nyc1.kubernetes.center")}, - State: to.Ptr(armavs.PlacementPolicyStateDisabled), - VMMembers: []*string{ - to.Ptr("/subscriptions/{subscription-id}/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), - to.Ptr("/subscriptions/{subscription-id}/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-256")}, - }, + poller, err := client.BeginUpdate(ctx, "group1", "cloud1", "cluster1", "policy1", armavs.PlacementPolicyUpdate{ + Properties: &armavs.PlacementPolicyUpdateProperties{ + AffinityStrength: to.Ptr(armavs.AffinityStrengthMust), + AzureHybridBenefitType: to.Ptr(armavs.AzureHybridBenefitTypeSQLHost), + HostMembers: []*string{ + to.Ptr("fakehost22.nyc1.kubernetes.center"), + to.Ptr("fakehost23.nyc1.kubernetes.center"), + to.Ptr("fakehost24.nyc1.kubernetes.center")}, + State: to.Ptr(armavs.PlacementPolicyStateDisabled), + VMMembers: []*string{ + to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), + to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-256")}, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -149,23 +133,18 @@ func ExamplePlacementPoliciesClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/PlacementPolicies_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PlacementPolicies_Delete.json func ExamplePlacementPoliciesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewPlacementPoliciesClient("{subscription-id}", cred, nil) + client, err := armavs.NewPlacementPoliciesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "group1", - "cloud1", - "cluster1", - "policy1", - nil) + poller, err := client.BeginDelete(ctx, "group1", "cloud1", "cluster1", "policy1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/avs/armavs/polymorphic_helpers.go similarity index 97% rename from sdk/resourcemanager/avs/armavs/zz_generated_polymorphic_helpers.go rename to sdk/resourcemanager/avs/armavs/polymorphic_helpers.go index 66bf6962f350..79d51b901887 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/avs/armavs/polymorphic_helpers.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -20,6 +21,8 @@ func unmarshalAddonPropertiesClassification(rawMsg json.RawMessage) (AddonProper } var b AddonPropertiesClassification switch m["addonType"] { + case string(AddonTypeArc): + b = &AddonArcProperties{} case string(AddonTypeHCX): b = &AddonHcxProperties{} case string(AddonTypeSRM): diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_privateclouds_client.go b/sdk/resourcemanager/avs/armavs/privateclouds_client.go similarity index 96% rename from sdk/resourcemanager/avs/armavs/zz_generated_privateclouds_client.go rename to sdk/resourcemanager/avs/armavs/privateclouds_client.go index 35312ca1896b..8d85eef23eab 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_privateclouds_client.go +++ b/sdk/resourcemanager/avs/armavs/privateclouds_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewPrivateCloudsClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Create or update a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // privateCloud - The private cloud @@ -76,7 +77,7 @@ func (client *PrivateCloudsClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Create or update a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *PrivateCloudsClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateCloudName string, privateCloud PrivateCloud, options *PrivateCloudsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateCloudName, privateCloud, options) if err != nil { @@ -112,7 +113,7 @@ func (client *PrivateCloudsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, privateCloud) @@ -120,7 +121,7 @@ func (client *PrivateCloudsClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Delete a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - PrivateCloudsClientBeginDeleteOptions contains the optional parameters for the PrivateCloudsClient.BeginDelete @@ -139,7 +140,7 @@ func (client *PrivateCloudsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Delete a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *PrivateCloudsClient) deleteOperation(ctx context.Context, resourceGroupName string, privateCloudName string, options *PrivateCloudsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateCloudName, options) if err != nil { @@ -175,7 +176,7 @@ func (client *PrivateCloudsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -183,7 +184,7 @@ func (client *PrivateCloudsClient) deleteCreateRequest(ctx context.Context, reso // Get - Get a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - PrivateCloudsClientGetOptions contains the optional parameters for the PrivateCloudsClient.Get method. @@ -222,7 +223,7 @@ func (client *PrivateCloudsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -238,8 +239,7 @@ func (client *PrivateCloudsClient) getHandleResponse(resp *http.Response) (Priva } // NewListPager - List private clouds in a resource group -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // options - PrivateCloudsClientListOptions contains the optional parameters for the PrivateCloudsClient.List method. func (client *PrivateCloudsClient) NewListPager(resourceGroupName string, options *PrivateCloudsClientListOptions) *runtime.Pager[PrivateCloudsClientListResponse] { @@ -286,7 +286,7 @@ func (client *PrivateCloudsClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -303,7 +303,7 @@ func (client *PrivateCloudsClient) listHandleResponse(resp *http.Response) (Priv // ListAdminCredentials - List the admin credentials for the private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - PrivateCloudsClientListAdminCredentialsOptions contains the optional parameters for the PrivateCloudsClient.ListAdminCredentials @@ -343,7 +343,7 @@ func (client *PrivateCloudsClient) listAdminCredentialsCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -359,8 +359,7 @@ func (client *PrivateCloudsClient) listAdminCredentialsHandleResponse(resp *http } // NewListInSubscriptionPager - List private clouds in a subscription -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // options - PrivateCloudsClientListInSubscriptionOptions contains the optional parameters for the PrivateCloudsClient.ListInSubscription // method. func (client *PrivateCloudsClient) NewListInSubscriptionPager(options *PrivateCloudsClientListInSubscriptionOptions) *runtime.Pager[PrivateCloudsClientListInSubscriptionResponse] { @@ -403,7 +402,7 @@ func (client *PrivateCloudsClient) listInSubscriptionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -420,7 +419,7 @@ func (client *PrivateCloudsClient) listInSubscriptionHandleResponse(resp *http.R // BeginRotateNsxtPassword - Rotate the NSX-T Manager password // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - PrivateCloudsClientBeginRotateNsxtPasswordOptions contains the optional parameters for the PrivateCloudsClient.BeginRotateNsxtPassword @@ -439,7 +438,7 @@ func (client *PrivateCloudsClient) BeginRotateNsxtPassword(ctx context.Context, // RotateNsxtPassword - Rotate the NSX-T Manager password // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *PrivateCloudsClient) rotateNsxtPassword(ctx context.Context, resourceGroupName string, privateCloudName string, options *PrivateCloudsClientBeginRotateNsxtPasswordOptions) (*http.Response, error) { req, err := client.rotateNsxtPasswordCreateRequest(ctx, resourceGroupName, privateCloudName, options) if err != nil { @@ -475,7 +474,7 @@ func (client *PrivateCloudsClient) rotateNsxtPasswordCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -483,7 +482,7 @@ func (client *PrivateCloudsClient) rotateNsxtPasswordCreateRequest(ctx context.C // BeginRotateVcenterPassword - Rotate the vCenter password // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - PrivateCloudsClientBeginRotateVcenterPasswordOptions contains the optional parameters for the PrivateCloudsClient.BeginRotateVcenterPassword @@ -502,7 +501,7 @@ func (client *PrivateCloudsClient) BeginRotateVcenterPassword(ctx context.Contex // RotateVcenterPassword - Rotate the vCenter password // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *PrivateCloudsClient) rotateVcenterPassword(ctx context.Context, resourceGroupName string, privateCloudName string, options *PrivateCloudsClientBeginRotateVcenterPasswordOptions) (*http.Response, error) { req, err := client.rotateVcenterPasswordCreateRequest(ctx, resourceGroupName, privateCloudName, options) if err != nil { @@ -538,7 +537,7 @@ func (client *PrivateCloudsClient) rotateVcenterPasswordCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -546,7 +545,7 @@ func (client *PrivateCloudsClient) rotateVcenterPasswordCreateRequest(ctx contex // BeginUpdate - Update a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // privateCloudUpdate - The private cloud properties to be updated @@ -566,7 +565,7 @@ func (client *PrivateCloudsClient) BeginUpdate(ctx context.Context, resourceGrou // Update - Update a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *PrivateCloudsClient) update(ctx context.Context, resourceGroupName string, privateCloudName string, privateCloudUpdate PrivateCloudUpdate, options *PrivateCloudsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, privateCloudName, privateCloudUpdate, options) if err != nil { @@ -602,7 +601,7 @@ func (client *PrivateCloudsClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, privateCloudUpdate) diff --git a/sdk/resourcemanager/avs/armavs/privateclouds_client_example_test.go b/sdk/resourcemanager/avs/armavs/privateclouds_client_example_test.go new file mode 100644 index 000000000000..cae6974838ad --- /dev/null +++ b/sdk/resourcemanager/avs/armavs/privateclouds_client_example_test.go @@ -0,0 +1,381 @@ +//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 armavs_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_List.json +func ExamplePrivateCloudsClient_NewListPager_privateCloudsList() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("group1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_List_Stretched.json +func ExamplePrivateCloudsClient_NewListPager_privateCloudsListStretched() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("group1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_ListInSubscription.json +func ExamplePrivateCloudsClient_NewListInSubscriptionPager_privateCloudsListInSubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListInSubscriptionPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_ListInSubscription_Stretched.json +func ExamplePrivateCloudsClient_NewListInSubscriptionPager_privateCloudsListInSubscriptionStretched() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListInSubscriptionPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_Get.json +func ExamplePrivateCloudsClient_Get_privateCloudsGet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "group1", "cloud1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_Get_Stretched.json +func ExamplePrivateCloudsClient_Get_privateCloudsGetStretched() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "group1", "cloud1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_CreateOrUpdate.json +func ExamplePrivateCloudsClient_BeginCreateOrUpdate_privateCloudsCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "group1", "cloud1", armavs.PrivateCloud{ + Location: to.Ptr("eastus2"), + Tags: map[string]*string{}, + Identity: &armavs.PrivateCloudIdentity{ + Type: to.Ptr(armavs.ResourceIdentityTypeSystemAssigned), + }, + Properties: &armavs.PrivateCloudProperties{ + ManagementCluster: &armavs.ManagementCluster{ + ClusterSize: to.Ptr[int32](4), + }, + NetworkBlock: to.Ptr("192.168.48.0/22"), + }, + SKU: &armavs.SKU{ + Name: to.Ptr("AV36"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_CreateOrUpdate_Stretched.json +func ExamplePrivateCloudsClient_BeginCreateOrUpdate_privateCloudsCreateOrUpdateStretched() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "group1", "cloud1", armavs.PrivateCloud{ + Location: to.Ptr("eastus2"), + Tags: map[string]*string{}, + Properties: &armavs.PrivateCloudProperties{ + Availability: &armavs.AvailabilityProperties{ + SecondaryZone: to.Ptr[int32](2), + Strategy: to.Ptr(armavs.AvailabilityStrategyDualZone), + Zone: to.Ptr[int32](1), + }, + ManagementCluster: &armavs.ManagementCluster{ + ClusterSize: to.Ptr[int32](4), + }, + NetworkBlock: to.Ptr("192.168.48.0/22"), + }, + SKU: &armavs.SKU{ + Name: to.Ptr("AV36"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_Update.json +func ExamplePrivateCloudsClient_BeginUpdate_privateCloudsUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginUpdate(ctx, "group1", "cloud1", armavs.PrivateCloudUpdate{ + Identity: &armavs.PrivateCloudIdentity{ + Type: to.Ptr(armavs.ResourceIdentityTypeNone), + }, + Properties: &armavs.PrivateCloudUpdateProperties{ + Encryption: &armavs.Encryption{ + KeyVaultProperties: &armavs.EncryptionKeyVaultProperties{ + KeyName: to.Ptr("keyname1"), + KeyVaultURL: to.Ptr("https://keyvault1-kmip-kvault.vault.azure.net/"), + KeyVersion: to.Ptr("ver1.0"), + }, + Status: to.Ptr(armavs.EncryptionStateEnabled), + }, + ManagementCluster: &armavs.ManagementCluster{ + ClusterSize: to.Ptr[int32](4), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_Update_Stretched.json +func ExamplePrivateCloudsClient_BeginUpdate_privateCloudsUpdateStretched() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginUpdate(ctx, "group1", "cloud1", armavs.PrivateCloudUpdate{ + Properties: &armavs.PrivateCloudUpdateProperties{ + ManagementCluster: &armavs.ManagementCluster{ + ClusterSize: to.Ptr[int32](4), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_Delete.json +func ExamplePrivateCloudsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, "group1", "cloud1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_RotateVcenterPassword.json +func ExamplePrivateCloudsClient_BeginRotateVcenterPassword() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginRotateVcenterPassword(ctx, "group1", "cloud1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_RotateNsxtPassword.json +func ExamplePrivateCloudsClient_BeginRotateNsxtPassword() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginRotateNsxtPassword(ctx, "group1", "cloud1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_ListAdminCredentials.json +func ExamplePrivateCloudsClient_ListAdminCredentials() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewPrivateCloudsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.ListAdminCredentials(ctx, "group1", "cloud1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_response_types.go b/sdk/resourcemanager/avs/armavs/response_types.go similarity index 97% rename from sdk/resourcemanager/avs/armavs/zz_generated_response_types.go rename to sdk/resourcemanager/avs/armavs/response_types.go index 2b8845d9ff4c..a91261376dbc 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_response_types.go +++ b/sdk/resourcemanager/avs/armavs/response_types.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -88,6 +89,11 @@ type ClustersClientListResponse struct { ClusterList } +// ClustersClientListZonesResponse contains the response from method ClustersClient.ListZones. +type ClustersClientListZonesResponse struct { + ClusterZoneList +} + // ClustersClientUpdateResponse contains the response from method ClustersClient.Update. type ClustersClientUpdateResponse struct { Cluster @@ -398,6 +404,11 @@ type WorkloadNetworksClientGetPublicIPResponse struct { WorkloadNetworkPublicIP } +// WorkloadNetworksClientGetResponse contains the response from method WorkloadNetworksClient.Get. +type WorkloadNetworksClientGetResponse struct { + WorkloadNetwork +} + // WorkloadNetworksClientGetSegmentResponse contains the response from method WorkloadNetworksClient.GetSegment. type WorkloadNetworksClientGetSegmentResponse struct { WorkloadNetworkSegment @@ -443,6 +454,11 @@ type WorkloadNetworksClientListPublicIPsResponse struct { WorkloadNetworkPublicIPsList } +// WorkloadNetworksClientListResponse contains the response from method WorkloadNetworksClient.List. +type WorkloadNetworksClientListResponse struct { + WorkloadNetworkList +} + // WorkloadNetworksClientListSegmentsResponse contains the response from method WorkloadNetworksClient.ListSegments. type WorkloadNetworksClientListSegmentsResponse struct { WorkloadNetworkSegmentsList diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_scriptcmdlets_client.go b/sdk/resourcemanager/avs/armavs/scriptcmdlets_client.go similarity index 97% rename from sdk/resourcemanager/avs/armavs/zz_generated_scriptcmdlets_client.go rename to sdk/resourcemanager/avs/armavs/scriptcmdlets_client.go index 622d2e6acd1e..ee2651ae9f7c 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_scriptcmdlets_client.go +++ b/sdk/resourcemanager/avs/armavs/scriptcmdlets_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewScriptCmdletsClient(subscriptionID string, credential azcore.TokenCreden // Get - Return information about a script cmdlet resource in a specific package on a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // scriptPackageName - Name of the script package in the private cloud @@ -105,7 +106,7 @@ func (client *ScriptCmdletsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -122,8 +123,7 @@ func (client *ScriptCmdletsClient) getHandleResponse(resp *http.Response) (Scrip // NewListPager - List script cmdlet resources available for a private cloud to create a script execution resource on a private // cloud -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // scriptPackageName - Name of the script package in the private cloud @@ -180,7 +180,7 @@ func (client *ScriptCmdletsClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_scriptcmdlets_client_test.go b/sdk/resourcemanager/avs/armavs/scriptcmdlets_client_example_test.go similarity index 75% rename from sdk/resourcemanager/avs/armavs/ze_generated_example_scriptcmdlets_client_test.go rename to sdk/resourcemanager/avs/armavs/scriptcmdlets_client_example_test.go index 537a45125887..1e9127e636ad 100644 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_scriptcmdlets_client_test.go +++ b/sdk/resourcemanager/avs/armavs/scriptcmdlets_client_example_test.go @@ -16,21 +16,18 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/ScriptCmdlets_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/ScriptCmdlets_List.json func ExampleScriptCmdletsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewScriptCmdletsClient("{subscription-id}", cred, nil) + client, err := armavs.NewScriptCmdletsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("group1", - "{privateCloudName}", - "{scriptPackageName}", - nil) + pager := client.NewListPager("group1", "{privateCloudName}", "{scriptPackageName}", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,23 +40,18 @@ func ExampleScriptCmdletsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/ScriptCmdlets_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/ScriptCmdlets_Get.json func ExampleScriptCmdletsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewScriptCmdletsClient("{subscription-id}", cred, nil) + client, err := armavs.NewScriptCmdletsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "group1", - "{privateCloudName}", - "{scriptPackageName}", - "New-ExternalSsoDomain", - nil) + res, err := client.Get(ctx, "group1", "{privateCloudName}", "{scriptPackageName}", "New-ExternalSsoDomain", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_scriptexecutions_client.go b/sdk/resourcemanager/avs/armavs/scriptexecutions_client.go similarity index 97% rename from sdk/resourcemanager/avs/armavs/zz_generated_scriptexecutions_client.go rename to sdk/resourcemanager/avs/armavs/scriptexecutions_client.go index 30b07dd520fe..cbfa63502274 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_scriptexecutions_client.go +++ b/sdk/resourcemanager/avs/armavs/scriptexecutions_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewScriptExecutionsClient(subscriptionID string, credential azcore.TokenCre // BeginCreateOrUpdate - Create or update a script execution in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - The name of the private cloud. // scriptExecutionName - Name of the user-invoked script execution resource @@ -77,7 +78,7 @@ func (client *ScriptExecutionsClient) BeginCreateOrUpdate(ctx context.Context, r // CreateOrUpdate - Create or update a script execution in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *ScriptExecutionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateCloudName string, scriptExecutionName string, scriptExecution ScriptExecution, options *ScriptExecutionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateCloudName, scriptExecutionName, scriptExecution, options) if err != nil { @@ -117,7 +118,7 @@ func (client *ScriptExecutionsClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, scriptExecution) @@ -125,7 +126,7 @@ func (client *ScriptExecutionsClient) createOrUpdateCreateRequest(ctx context.Co // BeginDelete - Cancel a ScriptExecution in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // scriptExecutionName - Name of the user-invoked script execution resource @@ -145,7 +146,7 @@ func (client *ScriptExecutionsClient) BeginDelete(ctx context.Context, resourceG // Delete - Cancel a ScriptExecution in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *ScriptExecutionsClient) deleteOperation(ctx context.Context, resourceGroupName string, privateCloudName string, scriptExecutionName string, options *ScriptExecutionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateCloudName, scriptExecutionName, options) if err != nil { @@ -185,7 +186,7 @@ func (client *ScriptExecutionsClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,7 +194,7 @@ func (client *ScriptExecutionsClient) deleteCreateRequest(ctx context.Context, r // Get - Get an script execution by name in a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // scriptExecutionName - Name of the user-invoked script execution resource @@ -237,7 +238,7 @@ func (client *ScriptExecutionsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,7 +255,7 @@ func (client *ScriptExecutionsClient) getHandleResponse(resp *http.Response) (Sc // GetExecutionLogs - Return the logs for a script execution resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // scriptExecutionName - Name of the user-invoked script execution resource @@ -299,7 +300,7 @@ func (client *ScriptExecutionsClient) getExecutionLogsCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.ScriptOutputStreamType != nil { @@ -318,8 +319,7 @@ func (client *ScriptExecutionsClient) getExecutionLogsHandleResponse(resp *http. } // NewListPager - List script executions in a private cloud -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - ScriptExecutionsClientListOptions contains the optional parameters for the ScriptExecutionsClient.List method. @@ -371,7 +371,7 @@ func (client *ScriptExecutionsClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_scriptexecutions_client_test.go b/sdk/resourcemanager/avs/armavs/scriptexecutions_client_example_test.go similarity index 56% rename from sdk/resourcemanager/avs/armavs/ze_generated_example_scriptexecutions_client_test.go rename to sdk/resourcemanager/avs/armavs/scriptexecutions_client_example_test.go index 5920e7496b2f..557acb66c6a5 100644 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_scriptexecutions_client_test.go +++ b/sdk/resourcemanager/avs/armavs/scriptexecutions_client_example_test.go @@ -17,20 +17,18 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/ScriptExecutions_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/ScriptExecutions_List.json func ExampleScriptExecutionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewScriptExecutionsClient("{subscription-id}", cred, nil) + client, err := armavs.NewScriptExecutionsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("group1", - "{privateCloudName}", - nil) + pager := client.NewListPager("group1", "{privateCloudName}", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,22 +41,18 @@ func ExampleScriptExecutionsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/ScriptExecutions_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/ScriptExecutions_Get.json func ExampleScriptExecutionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewScriptExecutionsClient("{subscription-id}", cred, nil) + client, err := armavs.NewScriptExecutionsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "group1", - "cloud1", - "addSsoServer", - nil) + res, err := client.Get(ctx, "group1", "cloud1", "addSsoServer", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,46 +60,41 @@ func ExampleScriptExecutionsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/ScriptExecutions_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/ScriptExecutions_CreateOrUpdate.json func ExampleScriptExecutionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewScriptExecutionsClient("{subscription-id}", cred, nil) + client, err := armavs.NewScriptExecutionsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "group1", - "cloud1", - "addSsoServer", - armavs.ScriptExecution{ - Properties: &armavs.ScriptExecutionProperties{ - HiddenParameters: []armavs.ScriptExecutionParameterClassification{ - &armavs.ScriptSecureStringExecutionParameter{ - Name: to.Ptr("Password"), - Type: to.Ptr(armavs.ScriptExecutionParameterTypeSecureValue), - SecureValue: to.Ptr("PlaceholderPassword"), - }}, - Parameters: []armavs.ScriptExecutionParameterClassification{ - &armavs.ScriptStringExecutionParameter{ - Name: to.Ptr("DomainName"), - Type: to.Ptr(armavs.ScriptExecutionParameterTypeValue), - Value: to.Ptr("placeholderDomain.local"), - }, - &armavs.ScriptStringExecutionParameter{ - Name: to.Ptr("BaseUserDN"), - Type: to.Ptr(armavs.ScriptExecutionParameterTypeValue), - Value: to.Ptr("DC=placeholder, DC=placeholder"), - }}, - Retention: to.Ptr("P0Y0M60DT0H60M60S"), - ScriptCmdletID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptPackages/AVS.PowerCommands@1.0.0/scriptCmdlets/New-SsoExternalIdentitySource"), - Timeout: to.Ptr("P0Y0M0DT0H60M60S"), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "group1", "cloud1", "addSsoServer", armavs.ScriptExecution{ + Properties: &armavs.ScriptExecutionProperties{ + HiddenParameters: []armavs.ScriptExecutionParameterClassification{ + &armavs.ScriptSecureStringExecutionParameter{ + Name: to.Ptr("Password"), + Type: to.Ptr(armavs.ScriptExecutionParameterTypeSecureValue), + SecureValue: to.Ptr("PlaceholderPassword"), + }}, + Parameters: []armavs.ScriptExecutionParameterClassification{ + &armavs.ScriptStringExecutionParameter{ + Name: to.Ptr("DomainName"), + Type: to.Ptr(armavs.ScriptExecutionParameterTypeValue), + Value: to.Ptr("placeholderDomain.local"), + }, + &armavs.ScriptStringExecutionParameter{ + Name: to.Ptr("BaseUserDN"), + Type: to.Ptr(armavs.ScriptExecutionParameterTypeValue), + Value: to.Ptr("DC=placeholder, DC=placeholder"), + }}, + Retention: to.Ptr("P0Y0M60DT0H60M60S"), + ScriptCmdletID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptPackages/AVS.PowerCommands@1.0.0/scriptCmdlets/New-SsoExternalIdentitySource"), + Timeout: to.Ptr("P0Y0M0DT0H60M60S"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -117,22 +106,18 @@ func ExampleScriptExecutionsClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/ScriptExecutions_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/ScriptExecutions_Delete.json func ExampleScriptExecutionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewScriptExecutionsClient("{subscription-id}", cred, nil) + client, err := armavs.NewScriptExecutionsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "group1", - "cloud1", - "{scriptExecutionName}", - nil) + poller, err := client.BeginDelete(ctx, "group1", "cloud1", "{scriptExecutionName}", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -142,27 +127,23 @@ func ExampleScriptExecutionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/ScriptExecutions_GetExecutionLogs.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/ScriptExecutions_GetExecutionLogs.json func ExampleScriptExecutionsClient_GetExecutionLogs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewScriptExecutionsClient("{subscription-id}", cred, nil) + client, err := armavs.NewScriptExecutionsClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.GetExecutionLogs(ctx, - "group1", - "cloud1", - "addSsoServer", - &armavs.ScriptExecutionsClientGetExecutionLogsOptions{ScriptOutputStreamType: []*armavs.ScriptOutputStreamType{ - to.Ptr(armavs.ScriptOutputStreamTypeInformation), - to.Ptr(armavs.ScriptOutputStreamType("Warnings")), - to.Ptr(armavs.ScriptOutputStreamType("Errors")), - to.Ptr(armavs.ScriptOutputStreamTypeOutput)}, - }) + res, err := client.GetExecutionLogs(ctx, "group1", "cloud1", "addSsoServer", &armavs.ScriptExecutionsClientGetExecutionLogsOptions{ScriptOutputStreamType: []*armavs.ScriptOutputStreamType{ + to.Ptr(armavs.ScriptOutputStreamTypeInformation), + to.Ptr(armavs.ScriptOutputStreamType("Warnings")), + to.Ptr(armavs.ScriptOutputStreamType("Errors")), + to.Ptr(armavs.ScriptOutputStreamTypeOutput)}, + }) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_scriptpackages_client.go b/sdk/resourcemanager/avs/armavs/scriptpackages_client.go similarity index 97% rename from sdk/resourcemanager/avs/armavs/zz_generated_scriptpackages_client.go rename to sdk/resourcemanager/avs/armavs/scriptpackages_client.go index a365e052599d..e6bca6bfbf99 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_scriptpackages_client.go +++ b/sdk/resourcemanager/avs/armavs/scriptpackages_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewScriptPackagesClient(subscriptionID string, credential azcore.TokenCrede // Get - Get a script package available to run on a private cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // scriptPackageName - Name of the script package in the private cloud @@ -100,7 +101,7 @@ func (client *ScriptPackagesClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -116,8 +117,7 @@ func (client *ScriptPackagesClient) getHandleResponse(resp *http.Response) (Scri } // NewListPager - List script packages available to run on the private cloud -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - ScriptPackagesClientListOptions contains the optional parameters for the ScriptPackagesClient.List method. @@ -169,7 +169,7 @@ func (client *ScriptPackagesClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_scriptpackages_client_test.go b/sdk/resourcemanager/avs/armavs/scriptpackages_client_example_test.go similarity index 77% rename from sdk/resourcemanager/avs/armavs/ze_generated_example_scriptpackages_client_test.go rename to sdk/resourcemanager/avs/armavs/scriptpackages_client_example_test.go index bc02b7623870..b05afb8f0ba8 100644 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_scriptpackages_client_test.go +++ b/sdk/resourcemanager/avs/armavs/scriptpackages_client_example_test.go @@ -16,20 +16,18 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/ScriptPackages_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/ScriptPackages_List.json func ExampleScriptPackagesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewScriptPackagesClient("{subscription-id}", cred, nil) + client, err := armavs.NewScriptPackagesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("group1", - "{privateCloudName}", - nil) + pager := client.NewListPager("group1", "{privateCloudName}", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -42,22 +40,18 @@ func ExampleScriptPackagesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/ScriptPackages_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/ScriptPackages_Get.json func ExampleScriptPackagesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewScriptPackagesClient("{subscription-id}", cred, nil) + client, err := armavs.NewScriptPackagesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "group1", - "{privateCloudName}", - "{scriptPackageName}", - nil) + res, err := client.Get(ctx, "group1", "{privateCloudName}", "{scriptPackageName}", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_time_rfc3339.go b/sdk/resourcemanager/avs/armavs/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/avs/armavs/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/avs/armavs/time_rfc3339.go index e97e4049f133..f4734684b4d9 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/avs/armavs/time_rfc3339.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_virtualmachines_client.go b/sdk/resourcemanager/avs/armavs/virtualmachines_client.go similarity index 97% rename from sdk/resourcemanager/avs/armavs/zz_generated_virtualmachines_client.go rename to sdk/resourcemanager/avs/armavs/virtualmachines_client.go index 2e28b01f0587..b2c9b41c7f3e 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_virtualmachines_client.go +++ b/sdk/resourcemanager/avs/armavs/virtualmachines_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewVirtualMachinesClient(subscriptionID string, credential azcore.TokenCred // Get - Get a virtual machine by id in a private cloud cluster // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -105,7 +106,7 @@ func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -121,8 +122,7 @@ func (client *VirtualMachinesClient) getHandleResponse(resp *http.Response) (Vir } // NewListPager - List of virtual machines in a private cloud cluster -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -179,7 +179,7 @@ func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -196,7 +196,7 @@ func (client *VirtualMachinesClient) listHandleResponse(resp *http.Response) (Vi // BeginRestrictMovement - Enable or disable DRS-driven VM movement restriction // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // clusterName - Name of the cluster in the private cloud @@ -218,7 +218,7 @@ func (client *VirtualMachinesClient) BeginRestrictMovement(ctx context.Context, // RestrictMovement - Enable or disable DRS-driven VM movement restriction // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *VirtualMachinesClient) restrictMovement(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, virtualMachineID string, restrictMovement VirtualMachineRestrictMovement, options *VirtualMachinesClientBeginRestrictMovementOptions) (*http.Response, error) { req, err := client.restrictMovementCreateRequest(ctx, resourceGroupName, privateCloudName, clusterName, virtualMachineID, restrictMovement, options) if err != nil { @@ -262,7 +262,7 @@ func (client *VirtualMachinesClient) restrictMovementCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, restrictMovement) diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_virtualmachines_client_test.go b/sdk/resourcemanager/avs/armavs/virtualmachines_client_example_test.go similarity index 73% rename from sdk/resourcemanager/avs/armavs/ze_generated_example_virtualmachines_client_test.go rename to sdk/resourcemanager/avs/armavs/virtualmachines_client_example_test.go index d27c01362e97..4c2e799793c7 100644 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_virtualmachines_client_test.go +++ b/sdk/resourcemanager/avs/armavs/virtualmachines_client_example_test.go @@ -17,21 +17,18 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/VirtualMachines_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/VirtualMachines_List.json func ExampleVirtualMachinesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewVirtualMachinesClient("{subscription-id}", cred, nil) + client, err := armavs.NewVirtualMachinesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("group1", - "cloud1", - "cluster1", - nil) + pager := client.NewListPager("group1", "cloud1", "cluster1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -44,23 +41,18 @@ func ExampleVirtualMachinesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/VirtualMachines_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/VirtualMachines_Get.json func ExampleVirtualMachinesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewVirtualMachinesClient("{subscription-id}", cred, nil) + client, err := armavs.NewVirtualMachinesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "group1", - "cloud1", - "cluster1", - "vm-209", - nil) + res, err := client.Get(ctx, "group1", "cloud1", "cluster1", "vm-209", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -68,26 +60,20 @@ func ExampleVirtualMachinesClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/VirtualMachines_RestrictMovement.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/VirtualMachines_RestrictMovement.json func ExampleVirtualMachinesClient_BeginRestrictMovement() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armavs.NewVirtualMachinesClient("{subscription-id}", cred, nil) + client, err := armavs.NewVirtualMachinesClient("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRestrictMovement(ctx, - "group1", - "cloud1", - "cluster1", - "vm-209", - armavs.VirtualMachineRestrictMovement{ - RestrictMovement: to.Ptr(armavs.VirtualMachineRestrictMovementStateEnabled), - }, - nil) + poller, err := client.BeginRestrictMovement(ctx, "group1", "cloud1", "cluster1", "vm-209", armavs.VirtualMachineRestrictMovement{ + RestrictMovement: to.Ptr(armavs.VirtualMachineRestrictMovementStateEnabled), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_workloadnetworks_client.go b/sdk/resourcemanager/avs/armavs/workloadnetworks_client.go similarity index 93% rename from sdk/resourcemanager/avs/armavs/zz_generated_workloadnetworks_client.go rename to sdk/resourcemanager/avs/armavs/workloadnetworks_client.go index 6dee2b1216e0..38379f9f8444 100644 --- a/sdk/resourcemanager/avs/armavs/zz_generated_workloadnetworks_client.go +++ b/sdk/resourcemanager/avs/armavs/workloadnetworks_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armavs @@ -56,7 +57,7 @@ func NewWorkloadNetworksClient(subscriptionID string, credential azcore.TokenCre // BeginCreateDNSService - Create a DNS service by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // dnsServiceID - NSX DNS Service identifier. Generally the same as the DNS Service's display name @@ -77,7 +78,7 @@ func (client *WorkloadNetworksClient) BeginCreateDNSService(ctx context.Context, // CreateDNSService - Create a DNS service by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) createDNSService(ctx context.Context, resourceGroupName string, privateCloudName string, dnsServiceID string, workloadNetworkDNSService WorkloadNetworkDNSService, options *WorkloadNetworksClientBeginCreateDNSServiceOptions) (*http.Response, error) { req, err := client.createDNSServiceCreateRequest(ctx, resourceGroupName, privateCloudName, dnsServiceID, workloadNetworkDNSService, options) if err != nil { @@ -117,7 +118,7 @@ func (client *WorkloadNetworksClient) createDNSServiceCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workloadNetworkDNSService) @@ -125,7 +126,7 @@ func (client *WorkloadNetworksClient) createDNSServiceCreateRequest(ctx context. // BeginCreateDNSZone - Create a DNS zone by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // dnsZoneID - NSX DNS Zone identifier. Generally the same as the DNS Zone's display name @@ -146,7 +147,7 @@ func (client *WorkloadNetworksClient) BeginCreateDNSZone(ctx context.Context, re // CreateDNSZone - Create a DNS zone by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) createDNSZone(ctx context.Context, resourceGroupName string, privateCloudName string, dnsZoneID string, workloadNetworkDNSZone WorkloadNetworkDNSZone, options *WorkloadNetworksClientBeginCreateDNSZoneOptions) (*http.Response, error) { req, err := client.createDNSZoneCreateRequest(ctx, resourceGroupName, privateCloudName, dnsZoneID, workloadNetworkDNSZone, options) if err != nil { @@ -186,7 +187,7 @@ func (client *WorkloadNetworksClient) createDNSZoneCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workloadNetworkDNSZone) @@ -194,7 +195,7 @@ func (client *WorkloadNetworksClient) createDNSZoneCreateRequest(ctx context.Con // BeginCreateDhcp - Create dhcp by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // dhcpID - NSX DHCP identifier. Generally the same as the DHCP display name @@ -215,7 +216,7 @@ func (client *WorkloadNetworksClient) BeginCreateDhcp(ctx context.Context, resou // CreateDhcp - Create dhcp by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) createDhcp(ctx context.Context, resourceGroupName string, privateCloudName string, dhcpID string, workloadNetworkDhcp WorkloadNetworkDhcp, options *WorkloadNetworksClientBeginCreateDhcpOptions) (*http.Response, error) { req, err := client.createDhcpCreateRequest(ctx, resourceGroupName, privateCloudName, dhcpID, workloadNetworkDhcp, options) if err != nil { @@ -255,7 +256,7 @@ func (client *WorkloadNetworksClient) createDhcpCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workloadNetworkDhcp) @@ -263,7 +264,7 @@ func (client *WorkloadNetworksClient) createDhcpCreateRequest(ctx context.Contex // BeginCreatePortMirroring - Create a port mirroring profile by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // portMirroringID - NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name @@ -284,7 +285,7 @@ func (client *WorkloadNetworksClient) BeginCreatePortMirroring(ctx context.Conte // CreatePortMirroring - Create a port mirroring profile by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) createPortMirroring(ctx context.Context, resourceGroupName string, privateCloudName string, portMirroringID string, workloadNetworkPortMirroring WorkloadNetworkPortMirroring, options *WorkloadNetworksClientBeginCreatePortMirroringOptions) (*http.Response, error) { req, err := client.createPortMirroringCreateRequest(ctx, resourceGroupName, privateCloudName, portMirroringID, workloadNetworkPortMirroring, options) if err != nil { @@ -324,7 +325,7 @@ func (client *WorkloadNetworksClient) createPortMirroringCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workloadNetworkPortMirroring) @@ -332,7 +333,7 @@ func (client *WorkloadNetworksClient) createPortMirroringCreateRequest(ctx conte // BeginCreatePublicIP - Create a Public IP Block by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // publicIPID - NSX Public IP Block identifier. Generally the same as the Public IP Block's display name @@ -353,7 +354,7 @@ func (client *WorkloadNetworksClient) BeginCreatePublicIP(ctx context.Context, r // CreatePublicIP - Create a Public IP Block by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) createPublicIP(ctx context.Context, resourceGroupName string, privateCloudName string, publicIPID string, workloadNetworkPublicIP WorkloadNetworkPublicIP, options *WorkloadNetworksClientBeginCreatePublicIPOptions) (*http.Response, error) { req, err := client.createPublicIPCreateRequest(ctx, resourceGroupName, privateCloudName, publicIPID, workloadNetworkPublicIP, options) if err != nil { @@ -393,7 +394,7 @@ func (client *WorkloadNetworksClient) createPublicIPCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workloadNetworkPublicIP) @@ -401,7 +402,7 @@ func (client *WorkloadNetworksClient) createPublicIPCreateRequest(ctx context.Co // BeginCreateSegments - Create a segment by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // segmentID - NSX Segment identifier. Generally the same as the Segment's display name @@ -422,7 +423,7 @@ func (client *WorkloadNetworksClient) BeginCreateSegments(ctx context.Context, r // CreateSegments - Create a segment by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) createSegments(ctx context.Context, resourceGroupName string, privateCloudName string, segmentID string, workloadNetworkSegment WorkloadNetworkSegment, options *WorkloadNetworksClientBeginCreateSegmentsOptions) (*http.Response, error) { req, err := client.createSegmentsCreateRequest(ctx, resourceGroupName, privateCloudName, segmentID, workloadNetworkSegment, options) if err != nil { @@ -462,7 +463,7 @@ func (client *WorkloadNetworksClient) createSegmentsCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workloadNetworkSegment) @@ -470,7 +471,7 @@ func (client *WorkloadNetworksClient) createSegmentsCreateRequest(ctx context.Co // BeginCreateVMGroup - Create a vm group by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // vmGroupID - NSX VM Group identifier. Generally the same as the VM Group's display name @@ -491,7 +492,7 @@ func (client *WorkloadNetworksClient) BeginCreateVMGroup(ctx context.Context, re // CreateVMGroup - Create a vm group by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) createVMGroup(ctx context.Context, resourceGroupName string, privateCloudName string, vmGroupID string, workloadNetworkVMGroup WorkloadNetworkVMGroup, options *WorkloadNetworksClientBeginCreateVMGroupOptions) (*http.Response, error) { req, err := client.createVMGroupCreateRequest(ctx, resourceGroupName, privateCloudName, vmGroupID, workloadNetworkVMGroup, options) if err != nil { @@ -531,7 +532,7 @@ func (client *WorkloadNetworksClient) createVMGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workloadNetworkVMGroup) @@ -539,7 +540,7 @@ func (client *WorkloadNetworksClient) createVMGroupCreateRequest(ctx context.Con // BeginDeleteDNSService - Delete a DNS service by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // dnsServiceID - NSX DNS Service identifier. Generally the same as the DNS Service's display name // privateCloudName - Name of the private cloud @@ -559,7 +560,7 @@ func (client *WorkloadNetworksClient) BeginDeleteDNSService(ctx context.Context, // DeleteDNSService - Delete a DNS service by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) deleteDNSService(ctx context.Context, resourceGroupName string, dnsServiceID string, privateCloudName string, options *WorkloadNetworksClientBeginDeleteDNSServiceOptions) (*http.Response, error) { req, err := client.deleteDNSServiceCreateRequest(ctx, resourceGroupName, dnsServiceID, privateCloudName, options) if err != nil { @@ -599,7 +600,7 @@ func (client *WorkloadNetworksClient) deleteDNSServiceCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -607,7 +608,7 @@ func (client *WorkloadNetworksClient) deleteDNSServiceCreateRequest(ctx context. // BeginDeleteDNSZone - Delete a DNS zone by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // dnsZoneID - NSX DNS Zone identifier. Generally the same as the DNS Zone's display name // privateCloudName - Name of the private cloud @@ -627,7 +628,7 @@ func (client *WorkloadNetworksClient) BeginDeleteDNSZone(ctx context.Context, re // DeleteDNSZone - Delete a DNS zone by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) deleteDNSZone(ctx context.Context, resourceGroupName string, dnsZoneID string, privateCloudName string, options *WorkloadNetworksClientBeginDeleteDNSZoneOptions) (*http.Response, error) { req, err := client.deleteDNSZoneCreateRequest(ctx, resourceGroupName, dnsZoneID, privateCloudName, options) if err != nil { @@ -667,7 +668,7 @@ func (client *WorkloadNetworksClient) deleteDNSZoneCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -675,7 +676,7 @@ func (client *WorkloadNetworksClient) deleteDNSZoneCreateRequest(ctx context.Con // BeginDeleteDhcp - Delete dhcp by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // dhcpID - NSX DHCP identifier. Generally the same as the DHCP display name @@ -695,7 +696,7 @@ func (client *WorkloadNetworksClient) BeginDeleteDhcp(ctx context.Context, resou // DeleteDhcp - Delete dhcp by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) deleteDhcp(ctx context.Context, resourceGroupName string, privateCloudName string, dhcpID string, options *WorkloadNetworksClientBeginDeleteDhcpOptions) (*http.Response, error) { req, err := client.deleteDhcpCreateRequest(ctx, resourceGroupName, privateCloudName, dhcpID, options) if err != nil { @@ -735,7 +736,7 @@ func (client *WorkloadNetworksClient) deleteDhcpCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -743,7 +744,7 @@ func (client *WorkloadNetworksClient) deleteDhcpCreateRequest(ctx context.Contex // BeginDeletePortMirroring - Delete a port mirroring profile by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // portMirroringID - NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name // privateCloudName - Name of the private cloud @@ -763,7 +764,7 @@ func (client *WorkloadNetworksClient) BeginDeletePortMirroring(ctx context.Conte // DeletePortMirroring - Delete a port mirroring profile by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) deletePortMirroring(ctx context.Context, resourceGroupName string, portMirroringID string, privateCloudName string, options *WorkloadNetworksClientBeginDeletePortMirroringOptions) (*http.Response, error) { req, err := client.deletePortMirroringCreateRequest(ctx, resourceGroupName, portMirroringID, privateCloudName, options) if err != nil { @@ -803,7 +804,7 @@ func (client *WorkloadNetworksClient) deletePortMirroringCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -811,7 +812,7 @@ func (client *WorkloadNetworksClient) deletePortMirroringCreateRequest(ctx conte // BeginDeletePublicIP - Delete a Public IP Block by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // publicIPID - NSX Public IP Block identifier. Generally the same as the Public IP Block's display name // privateCloudName - Name of the private cloud @@ -831,7 +832,7 @@ func (client *WorkloadNetworksClient) BeginDeletePublicIP(ctx context.Context, r // DeletePublicIP - Delete a Public IP Block by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) deletePublicIP(ctx context.Context, resourceGroupName string, publicIPID string, privateCloudName string, options *WorkloadNetworksClientBeginDeletePublicIPOptions) (*http.Response, error) { req, err := client.deletePublicIPCreateRequest(ctx, resourceGroupName, publicIPID, privateCloudName, options) if err != nil { @@ -871,7 +872,7 @@ func (client *WorkloadNetworksClient) deletePublicIPCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -879,7 +880,7 @@ func (client *WorkloadNetworksClient) deletePublicIPCreateRequest(ctx context.Co // BeginDeleteSegment - Delete a segment by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // segmentID - NSX Segment identifier. Generally the same as the Segment's display name @@ -899,7 +900,7 @@ func (client *WorkloadNetworksClient) BeginDeleteSegment(ctx context.Context, re // DeleteSegment - Delete a segment by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) deleteSegment(ctx context.Context, resourceGroupName string, privateCloudName string, segmentID string, options *WorkloadNetworksClientBeginDeleteSegmentOptions) (*http.Response, error) { req, err := client.deleteSegmentCreateRequest(ctx, resourceGroupName, privateCloudName, segmentID, options) if err != nil { @@ -939,7 +940,7 @@ func (client *WorkloadNetworksClient) deleteSegmentCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -947,7 +948,7 @@ func (client *WorkloadNetworksClient) deleteSegmentCreateRequest(ctx context.Con // BeginDeleteVMGroup - Delete a vm group by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // vmGroupID - NSX VM Group identifier. Generally the same as the VM Group's display name // privateCloudName - Name of the private cloud @@ -967,7 +968,7 @@ func (client *WorkloadNetworksClient) BeginDeleteVMGroup(ctx context.Context, re // DeleteVMGroup - Delete a vm group by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) deleteVMGroup(ctx context.Context, resourceGroupName string, vmGroupID string, privateCloudName string, options *WorkloadNetworksClientBeginDeleteVMGroupOptions) (*http.Response, error) { req, err := client.deleteVMGroupCreateRequest(ctx, resourceGroupName, vmGroupID, privateCloudName, options) if err != nil { @@ -1007,15 +1008,76 @@ func (client *WorkloadNetworksClient) deleteVMGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } +// Get - Get a private cloud workload network. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// privateCloudName - Name of the private cloud +// workloadNetworkName - Name for the workload network in the private cloud +// options - WorkloadNetworksClientGetOptions contains the optional parameters for the WorkloadNetworksClient.Get method. +func (client *WorkloadNetworksClient) Get(ctx context.Context, resourceGroupName string, privateCloudName string, workloadNetworkName WorkloadNetworkName, options *WorkloadNetworksClientGetOptions) (WorkloadNetworksClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, privateCloudName, workloadNetworkName, options) + if err != nil { + return WorkloadNetworksClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkloadNetworksClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkloadNetworksClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkloadNetworksClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, workloadNetworkName WorkloadNetworkName, options *WorkloadNetworksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/{workloadNetworkName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateCloudName == "" { + return nil, errors.New("parameter privateCloudName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateCloudName}", url.PathEscape(privateCloudName)) + if workloadNetworkName == "" { + return nil, errors.New("parameter workloadNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workloadNetworkName}", url.PathEscape(string(workloadNetworkName))) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkloadNetworksClient) getHandleResponse(resp *http.Response) (WorkloadNetworksClientGetResponse, error) { + result := WorkloadNetworksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkloadNetwork); err != nil { + return WorkloadNetworksClientGetResponse{}, err + } + return result, nil +} + // GetDNSService - Get a DNS service by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // dnsServiceID - NSX DNS Service identifier. Generally the same as the DNS Service's display name @@ -1060,7 +1122,7 @@ func (client *WorkloadNetworksClient) getDNSServiceCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1077,7 +1139,7 @@ func (client *WorkloadNetworksClient) getDNSServiceHandleResponse(resp *http.Res // GetDNSZone - Get a DNS zone by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // dnsZoneID - NSX DNS Zone identifier. Generally the same as the DNS Zone's display name @@ -1122,7 +1184,7 @@ func (client *WorkloadNetworksClient) getDNSZoneCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1139,7 +1201,7 @@ func (client *WorkloadNetworksClient) getDNSZoneHandleResponse(resp *http.Respon // GetDhcp - Get dhcp by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // dhcpID - NSX DHCP identifier. Generally the same as the DHCP display name // privateCloudName - Name of the private cloud @@ -1184,7 +1246,7 @@ func (client *WorkloadNetworksClient) getDhcpCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1201,7 +1263,7 @@ func (client *WorkloadNetworksClient) getDhcpHandleResponse(resp *http.Response) // GetGateway - Get a gateway by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // gatewayID - NSX Gateway identifier. Generally the same as the Gateway's display name @@ -1246,7 +1308,7 @@ func (client *WorkloadNetworksClient) getGatewayCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1263,7 +1325,7 @@ func (client *WorkloadNetworksClient) getGatewayHandleResponse(resp *http.Respon // GetPortMirroring - Get a port mirroring profile by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // portMirroringID - NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name @@ -1308,7 +1370,7 @@ func (client *WorkloadNetworksClient) getPortMirroringCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1325,7 +1387,7 @@ func (client *WorkloadNetworksClient) getPortMirroringHandleResponse(resp *http. // GetPublicIP - Get a Public IP Block by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // publicIPID - NSX Public IP Block identifier. Generally the same as the Public IP Block's display name @@ -1370,7 +1432,7 @@ func (client *WorkloadNetworksClient) getPublicIPCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1387,7 +1449,7 @@ func (client *WorkloadNetworksClient) getPublicIPHandleResponse(resp *http.Respo // GetSegment - Get a segment by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // segmentID - NSX Segment identifier. Generally the same as the Segment's display name @@ -1432,7 +1494,7 @@ func (client *WorkloadNetworksClient) getSegmentCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1449,7 +1511,7 @@ func (client *WorkloadNetworksClient) getSegmentHandleResponse(resp *http.Respon // GetVMGroup - Get a vm group by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // vmGroupID - NSX VM Group identifier. Generally the same as the VM Group's display name @@ -1494,7 +1556,7 @@ func (client *WorkloadNetworksClient) getVMGroupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1511,7 +1573,7 @@ func (client *WorkloadNetworksClient) getVMGroupHandleResponse(resp *http.Respon // GetVirtualMachine - Get a virtual machine by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // virtualMachineID - Virtual Machine identifier @@ -1556,7 +1618,7 @@ func (client *WorkloadNetworksClient) getVirtualMachineCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1571,9 +1633,76 @@ func (client *WorkloadNetworksClient) getVirtualMachineHandleResponse(resp *http return result, nil } +// NewListPager - List of workload networks in a private cloud. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// privateCloudName - Name of the private cloud +// options - WorkloadNetworksClientListOptions contains the optional parameters for the WorkloadNetworksClient.List method. +func (client *WorkloadNetworksClient) NewListPager(resourceGroupName string, privateCloudName string, options *WorkloadNetworksClientListOptions) *runtime.Pager[WorkloadNetworksClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkloadNetworksClientListResponse]{ + More: func(page WorkloadNetworksClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkloadNetworksClientListResponse) (WorkloadNetworksClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, privateCloudName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkloadNetworksClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkloadNetworksClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkloadNetworksClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *WorkloadNetworksClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *WorkloadNetworksClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateCloudName == "" { + return nil, errors.New("parameter privateCloudName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateCloudName}", url.PathEscape(privateCloudName)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *WorkloadNetworksClient) listHandleResponse(resp *http.Response) (WorkloadNetworksClientListResponse, error) { + result := WorkloadNetworksClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkloadNetworkList); err != nil { + return WorkloadNetworksClientListResponse{}, err + } + return result, nil +} + // NewListDNSServicesPager - List of DNS services in a private cloud workload network. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - WorkloadNetworksClientListDNSServicesOptions contains the optional parameters for the WorkloadNetworksClient.ListDNSServices @@ -1626,7 +1755,7 @@ func (client *WorkloadNetworksClient) listDNSServicesCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1642,8 +1771,7 @@ func (client *WorkloadNetworksClient) listDNSServicesHandleResponse(resp *http.R } // NewListDNSZonesPager - List of DNS zones in a private cloud workload network. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - WorkloadNetworksClientListDNSZonesOptions contains the optional parameters for the WorkloadNetworksClient.ListDNSZones @@ -1696,7 +1824,7 @@ func (client *WorkloadNetworksClient) listDNSZonesCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1712,8 +1840,7 @@ func (client *WorkloadNetworksClient) listDNSZonesHandleResponse(resp *http.Resp } // NewListDhcpPager - List dhcp in a private cloud workload network. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - WorkloadNetworksClientListDhcpOptions contains the optional parameters for the WorkloadNetworksClient.ListDhcp @@ -1766,7 +1893,7 @@ func (client *WorkloadNetworksClient) listDhcpCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1782,8 +1909,7 @@ func (client *WorkloadNetworksClient) listDhcpHandleResponse(resp *http.Response } // NewListGatewaysPager - List of gateways in a private cloud workload network. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - WorkloadNetworksClientListGatewaysOptions contains the optional parameters for the WorkloadNetworksClient.ListGateways @@ -1836,7 +1962,7 @@ func (client *WorkloadNetworksClient) listGatewaysCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1852,8 +1978,7 @@ func (client *WorkloadNetworksClient) listGatewaysHandleResponse(resp *http.Resp } // NewListPortMirroringPager - List of port mirroring profiles in a private cloud workload network. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - WorkloadNetworksClientListPortMirroringOptions contains the optional parameters for the WorkloadNetworksClient.ListPortMirroring @@ -1906,7 +2031,7 @@ func (client *WorkloadNetworksClient) listPortMirroringCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1922,8 +2047,7 @@ func (client *WorkloadNetworksClient) listPortMirroringHandleResponse(resp *http } // NewListPublicIPsPager - List of Public IP Blocks in a private cloud workload network. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - WorkloadNetworksClientListPublicIPsOptions contains the optional parameters for the WorkloadNetworksClient.ListPublicIPs @@ -1976,7 +2100,7 @@ func (client *WorkloadNetworksClient) listPublicIPsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1992,8 +2116,7 @@ func (client *WorkloadNetworksClient) listPublicIPsHandleResponse(resp *http.Res } // NewListSegmentsPager - List of segments in a private cloud workload network. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - WorkloadNetworksClientListSegmentsOptions contains the optional parameters for the WorkloadNetworksClient.ListSegments @@ -2046,7 +2169,7 @@ func (client *WorkloadNetworksClient) listSegmentsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2062,8 +2185,7 @@ func (client *WorkloadNetworksClient) listSegmentsHandleResponse(resp *http.Resp } // NewListVMGroupsPager - List of vm groups in a private cloud workload network. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - WorkloadNetworksClientListVMGroupsOptions contains the optional parameters for the WorkloadNetworksClient.ListVMGroups @@ -2116,7 +2238,7 @@ func (client *WorkloadNetworksClient) listVMGroupsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2132,8 +2254,7 @@ func (client *WorkloadNetworksClient) listVMGroupsHandleResponse(resp *http.Resp } // NewListVirtualMachinesPager - List of virtual machines in a private cloud workload network. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // options - WorkloadNetworksClientListVirtualMachinesOptions contains the optional parameters for the WorkloadNetworksClient.ListVirtualMachines @@ -2186,7 +2307,7 @@ func (client *WorkloadNetworksClient) listVirtualMachinesCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2203,7 +2324,7 @@ func (client *WorkloadNetworksClient) listVirtualMachinesHandleResponse(resp *ht // BeginUpdateDNSService - Create or update a DNS service by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // dnsServiceID - NSX DNS Service identifier. Generally the same as the DNS Service's display name @@ -2224,7 +2345,7 @@ func (client *WorkloadNetworksClient) BeginUpdateDNSService(ctx context.Context, // UpdateDNSService - Create or update a DNS service by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) updateDNSService(ctx context.Context, resourceGroupName string, privateCloudName string, dnsServiceID string, workloadNetworkDNSService WorkloadNetworkDNSService, options *WorkloadNetworksClientBeginUpdateDNSServiceOptions) (*http.Response, error) { req, err := client.updateDNSServiceCreateRequest(ctx, resourceGroupName, privateCloudName, dnsServiceID, workloadNetworkDNSService, options) if err != nil { @@ -2264,7 +2385,7 @@ func (client *WorkloadNetworksClient) updateDNSServiceCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workloadNetworkDNSService) @@ -2272,7 +2393,7 @@ func (client *WorkloadNetworksClient) updateDNSServiceCreateRequest(ctx context. // BeginUpdateDNSZone - Create or update a DNS zone by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // dnsZoneID - NSX DNS Zone identifier. Generally the same as the DNS Zone's display name @@ -2293,7 +2414,7 @@ func (client *WorkloadNetworksClient) BeginUpdateDNSZone(ctx context.Context, re // UpdateDNSZone - Create or update a DNS zone by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) updateDNSZone(ctx context.Context, resourceGroupName string, privateCloudName string, dnsZoneID string, workloadNetworkDNSZone WorkloadNetworkDNSZone, options *WorkloadNetworksClientBeginUpdateDNSZoneOptions) (*http.Response, error) { req, err := client.updateDNSZoneCreateRequest(ctx, resourceGroupName, privateCloudName, dnsZoneID, workloadNetworkDNSZone, options) if err != nil { @@ -2333,7 +2454,7 @@ func (client *WorkloadNetworksClient) updateDNSZoneCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workloadNetworkDNSZone) @@ -2341,7 +2462,7 @@ func (client *WorkloadNetworksClient) updateDNSZoneCreateRequest(ctx context.Con // BeginUpdateDhcp - Create or update dhcp by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // dhcpID - NSX DHCP identifier. Generally the same as the DHCP display name @@ -2362,7 +2483,7 @@ func (client *WorkloadNetworksClient) BeginUpdateDhcp(ctx context.Context, resou // UpdateDhcp - Create or update dhcp by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) updateDhcp(ctx context.Context, resourceGroupName string, privateCloudName string, dhcpID string, workloadNetworkDhcp WorkloadNetworkDhcp, options *WorkloadNetworksClientBeginUpdateDhcpOptions) (*http.Response, error) { req, err := client.updateDhcpCreateRequest(ctx, resourceGroupName, privateCloudName, dhcpID, workloadNetworkDhcp, options) if err != nil { @@ -2402,7 +2523,7 @@ func (client *WorkloadNetworksClient) updateDhcpCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workloadNetworkDhcp) @@ -2410,7 +2531,7 @@ func (client *WorkloadNetworksClient) updateDhcpCreateRequest(ctx context.Contex // BeginUpdatePortMirroring - Create or update a port mirroring profile by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // portMirroringID - NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name @@ -2431,7 +2552,7 @@ func (client *WorkloadNetworksClient) BeginUpdatePortMirroring(ctx context.Conte // UpdatePortMirroring - Create or update a port mirroring profile by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) updatePortMirroring(ctx context.Context, resourceGroupName string, privateCloudName string, portMirroringID string, workloadNetworkPortMirroring WorkloadNetworkPortMirroring, options *WorkloadNetworksClientBeginUpdatePortMirroringOptions) (*http.Response, error) { req, err := client.updatePortMirroringCreateRequest(ctx, resourceGroupName, privateCloudName, portMirroringID, workloadNetworkPortMirroring, options) if err != nil { @@ -2471,7 +2592,7 @@ func (client *WorkloadNetworksClient) updatePortMirroringCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workloadNetworkPortMirroring) @@ -2479,7 +2600,7 @@ func (client *WorkloadNetworksClient) updatePortMirroringCreateRequest(ctx conte // BeginUpdateSegments - Create or update a segment by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // segmentID - NSX Segment identifier. Generally the same as the Segment's display name @@ -2500,7 +2621,7 @@ func (client *WorkloadNetworksClient) BeginUpdateSegments(ctx context.Context, r // UpdateSegments - Create or update a segment by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) updateSegments(ctx context.Context, resourceGroupName string, privateCloudName string, segmentID string, workloadNetworkSegment WorkloadNetworkSegment, options *WorkloadNetworksClientBeginUpdateSegmentsOptions) (*http.Response, error) { req, err := client.updateSegmentsCreateRequest(ctx, resourceGroupName, privateCloudName, segmentID, workloadNetworkSegment, options) if err != nil { @@ -2540,7 +2661,7 @@ func (client *WorkloadNetworksClient) updateSegmentsCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workloadNetworkSegment) @@ -2548,7 +2669,7 @@ func (client *WorkloadNetworksClient) updateSegmentsCreateRequest(ctx context.Co // BeginUpdateVMGroup - Create or update a vm group by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // privateCloudName - Name of the private cloud // vmGroupID - NSX VM Group identifier. Generally the same as the VM Group's display name @@ -2569,7 +2690,7 @@ func (client *WorkloadNetworksClient) BeginUpdateVMGroup(ctx context.Context, re // UpdateVMGroup - Create or update a vm group by id in a private cloud workload network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 +// Generated from API version 2022-05-01 func (client *WorkloadNetworksClient) updateVMGroup(ctx context.Context, resourceGroupName string, privateCloudName string, vmGroupID string, workloadNetworkVMGroup WorkloadNetworkVMGroup, options *WorkloadNetworksClientBeginUpdateVMGroupOptions) (*http.Response, error) { req, err := client.updateVMGroupCreateRequest(ctx, resourceGroupName, privateCloudName, vmGroupID, workloadNetworkVMGroup, options) if err != nil { @@ -2609,7 +2730,7 @@ func (client *WorkloadNetworksClient) updateVMGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workloadNetworkVMGroup) diff --git a/sdk/resourcemanager/avs/armavs/workloadnetworks_client_example_test.go b/sdk/resourcemanager/avs/armavs/workloadnetworks_client_example_test.go new file mode 100644 index 000000000000..0eeddfb8b880 --- /dev/null +++ b/sdk/resourcemanager/avs/armavs/workloadnetworks_client_example_test.go @@ -0,0 +1,1001 @@ +//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 armavs_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_Get.json +func ExampleWorkloadNetworksClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "group1", "cloud1", armavs.WorkloadNetworkNameDefault, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_List.json +func ExampleWorkloadNetworksClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("group1", "cloud1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_ListSegments.json +func ExampleWorkloadNetworksClient_NewListSegmentsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListSegmentsPager("group1", "cloud1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetSegments.json +func ExampleWorkloadNetworksClient_GetSegment() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetSegment(ctx, "group1", "cloud1", "segment1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_CreateSegments.json +func ExampleWorkloadNetworksClient_BeginCreateSegments() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateSegments(ctx, "group1", "cloud1", "segment1", armavs.WorkloadNetworkSegment{ + Properties: &armavs.WorkloadNetworkSegmentProperties{ + ConnectedGateway: to.Ptr("/infra/tier-1s/gateway"), + DisplayName: to.Ptr("segment1"), + Revision: to.Ptr[int64](1), + Subnet: &armavs.WorkloadNetworkSegmentSubnet{ + DhcpRanges: []*string{ + to.Ptr("40.20.0.0-40.20.0.1")}, + GatewayAddress: to.Ptr("40.20.20.20/16"), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_UpdateSegments.json +func ExampleWorkloadNetworksClient_BeginUpdateSegments() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginUpdateSegments(ctx, "group1", "cloud1", "segment1", armavs.WorkloadNetworkSegment{ + Properties: &armavs.WorkloadNetworkSegmentProperties{ + ConnectedGateway: to.Ptr("/infra/tier-1s/gateway"), + Revision: to.Ptr[int64](1), + Subnet: &armavs.WorkloadNetworkSegmentSubnet{ + DhcpRanges: []*string{ + to.Ptr("40.20.0.0-40.20.0.1")}, + GatewayAddress: to.Ptr("40.20.20.20/16"), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_DeleteSegments.json +func ExampleWorkloadNetworksClient_BeginDeleteSegment() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDeleteSegment(ctx, "group1", "cloud1", "segment1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_ListDhcpConfigurations.json +func ExampleWorkloadNetworksClient_NewListDhcpPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListDhcpPager("group1", "cloud1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetDhcpConfigurations.json +func ExampleWorkloadNetworksClient_GetDhcp() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetDhcp(ctx, "group1", "dhcp1", "cloud1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_CreateDhcpConfigurations.json +func ExampleWorkloadNetworksClient_BeginCreateDhcp() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateDhcp(ctx, "group1", "cloud1", "dhcp1", armavs.WorkloadNetworkDhcp{ + Properties: &armavs.WorkloadNetworkDhcpServer{ + DhcpType: to.Ptr(armavs.DhcpTypeEnumSERVER), + DisplayName: to.Ptr("dhcpConfigurations1"), + Revision: to.Ptr[int64](1), + LeaseTime: to.Ptr[int64](86400), + ServerAddress: to.Ptr("40.1.5.1/24"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_UpdateDhcpConfigurations.json +func ExampleWorkloadNetworksClient_BeginUpdateDhcp() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginUpdateDhcp(ctx, "group1", "cloud1", "dhcp1", armavs.WorkloadNetworkDhcp{ + Properties: &armavs.WorkloadNetworkDhcpServer{ + DhcpType: to.Ptr(armavs.DhcpTypeEnumSERVER), + Revision: to.Ptr[int64](1), + LeaseTime: to.Ptr[int64](86400), + ServerAddress: to.Ptr("40.1.5.1/24"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_DeleteDhcpConfigurations.json +func ExampleWorkloadNetworksClient_BeginDeleteDhcp() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDeleteDhcp(ctx, "group1", "cloud1", "dhcp1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_ListGateways.json +func ExampleWorkloadNetworksClient_NewListGatewaysPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListGatewaysPager("group1", "cloud1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetGateway.json +func ExampleWorkloadNetworksClient_GetGateway() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetGateway(ctx, "group1", "cloud1", "gateway1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_ListPortMirroringProfiles.json +func ExampleWorkloadNetworksClient_NewListPortMirroringPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPortMirroringPager("group1", "cloud1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetPortMirroringProfiles.json +func ExampleWorkloadNetworksClient_GetPortMirroring() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetPortMirroring(ctx, "group1", "cloud1", "portMirroring1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_CreatePortMirroringProfiles.json +func ExampleWorkloadNetworksClient_BeginCreatePortMirroring() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreatePortMirroring(ctx, "group1", "cloud1", "portMirroring1", armavs.WorkloadNetworkPortMirroring{ + Properties: &armavs.WorkloadNetworkPortMirroringProperties{ + Destination: to.Ptr("vmGroup2"), + Direction: to.Ptr(armavs.PortMirroringDirectionEnumBIDIRECTIONAL), + DisplayName: to.Ptr("portMirroring1"), + Revision: to.Ptr[int64](1), + Source: to.Ptr("vmGroup1"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_UpdatePortMirroringProfiles.json +func ExampleWorkloadNetworksClient_BeginUpdatePortMirroring() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginUpdatePortMirroring(ctx, "group1", "cloud1", "portMirroring1", armavs.WorkloadNetworkPortMirroring{ + Properties: &armavs.WorkloadNetworkPortMirroringProperties{ + Destination: to.Ptr("vmGroup2"), + Direction: to.Ptr(armavs.PortMirroringDirectionEnumBIDIRECTIONAL), + Revision: to.Ptr[int64](1), + Source: to.Ptr("vmGroup1"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_DeletePortMirroringProfiles.json +func ExampleWorkloadNetworksClient_BeginDeletePortMirroring() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDeletePortMirroring(ctx, "group1", "portMirroring1", "cloud1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_ListVMGroups.json +func ExampleWorkloadNetworksClient_NewListVMGroupsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListVMGroupsPager("group1", "cloud1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetVMGroups.json +func ExampleWorkloadNetworksClient_GetVMGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetVMGroup(ctx, "group1", "cloud1", "vmGroup1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_CreateVMGroups.json +func ExampleWorkloadNetworksClient_BeginCreateVMGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateVMGroup(ctx, "group1", "cloud1", "vmGroup1", armavs.WorkloadNetworkVMGroup{ + Properties: &armavs.WorkloadNetworkVMGroupProperties{ + DisplayName: to.Ptr("vmGroup1"), + Members: []*string{ + to.Ptr("564d43da-fefc-2a3b-1d92-42855622fa50")}, + Revision: to.Ptr[int64](1), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_UpdateVMGroups.json +func ExampleWorkloadNetworksClient_BeginUpdateVMGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginUpdateVMGroup(ctx, "group1", "cloud1", "vmGroup1", armavs.WorkloadNetworkVMGroup{ + Properties: &armavs.WorkloadNetworkVMGroupProperties{ + Members: []*string{ + to.Ptr("564d43da-fefc-2a3b-1d92-42855622fa50")}, + Revision: to.Ptr[int64](1), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_DeleteVMGroups.json +func ExampleWorkloadNetworksClient_BeginDeleteVMGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDeleteVMGroup(ctx, "group1", "vmGroup1", "cloud1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_ListVirtualMachines.json +func ExampleWorkloadNetworksClient_NewListVirtualMachinesPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListVirtualMachinesPager("group1", "cloud1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetVirtualMachine.json +func ExampleWorkloadNetworksClient_GetVirtualMachine() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetVirtualMachine(ctx, "group1", "cloud1", "vm1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_ListDnsServices.json +func ExampleWorkloadNetworksClient_NewListDNSServicesPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListDNSServicesPager("group1", "cloud1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetDnsServices.json +func ExampleWorkloadNetworksClient_GetDNSService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetDNSService(ctx, "group1", "cloud1", "dnsService1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_CreateDnsServices.json +func ExampleWorkloadNetworksClient_BeginCreateDNSService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateDNSService(ctx, "group1", "cloud1", "dnsService1", armavs.WorkloadNetworkDNSService{ + Properties: &armavs.WorkloadNetworkDNSServiceProperties{ + DefaultDNSZone: to.Ptr("defaultDnsZone1"), + DisplayName: to.Ptr("dnsService1"), + DNSServiceIP: to.Ptr("5.5.5.5"), + FqdnZones: []*string{ + to.Ptr("fqdnZone1")}, + LogLevel: to.Ptr(armavs.DNSServiceLogLevelEnumINFO), + Revision: to.Ptr[int64](1), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_UpdateDnsServices.json +func ExampleWorkloadNetworksClient_BeginUpdateDNSService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginUpdateDNSService(ctx, "group1", "cloud1", "dnsService1", armavs.WorkloadNetworkDNSService{ + Properties: &armavs.WorkloadNetworkDNSServiceProperties{ + DefaultDNSZone: to.Ptr("defaultDnsZone1"), + DisplayName: to.Ptr("dnsService1"), + DNSServiceIP: to.Ptr("5.5.5.5"), + FqdnZones: []*string{ + to.Ptr("fqdnZone1")}, + LogLevel: to.Ptr(armavs.DNSServiceLogLevelEnumINFO), + Revision: to.Ptr[int64](1), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_DeleteDnsServices.json +func ExampleWorkloadNetworksClient_BeginDeleteDNSService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDeleteDNSService(ctx, "group1", "dnsService1", "cloud1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_ListDnsZones.json +func ExampleWorkloadNetworksClient_NewListDNSZonesPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListDNSZonesPager("group1", "cloud1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetDnsZones.json +func ExampleWorkloadNetworksClient_GetDNSZone() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetDNSZone(ctx, "group1", "cloud1", "dnsZone1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_CreateDnsZones.json +func ExampleWorkloadNetworksClient_BeginCreateDNSZone() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateDNSZone(ctx, "group1", "cloud1", "dnsZone1", armavs.WorkloadNetworkDNSZone{ + Properties: &armavs.WorkloadNetworkDNSZoneProperties{ + DisplayName: to.Ptr("dnsZone1"), + DNSServerIPs: []*string{ + to.Ptr("1.1.1.1")}, + Domain: []*string{}, + Revision: to.Ptr[int64](1), + SourceIP: to.Ptr("8.8.8.8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_UpdateDnsZones.json +func ExampleWorkloadNetworksClient_BeginUpdateDNSZone() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginUpdateDNSZone(ctx, "group1", "cloud1", "dnsZone1", armavs.WorkloadNetworkDNSZone{ + Properties: &armavs.WorkloadNetworkDNSZoneProperties{ + DisplayName: to.Ptr("dnsZone1"), + DNSServerIPs: []*string{ + to.Ptr("1.1.1.1")}, + Domain: []*string{}, + Revision: to.Ptr[int64](1), + SourceIP: to.Ptr("8.8.8.8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_DeleteDnsZones.json +func ExampleWorkloadNetworksClient_BeginDeleteDNSZone() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDeleteDNSZone(ctx, "group1", "dnsZone1", "cloud1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_ListPublicIPs.json +func ExampleWorkloadNetworksClient_NewListPublicIPsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPublicIPsPager("group1", "cloud1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetPublicIPs.json +func ExampleWorkloadNetworksClient_GetPublicIP() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetPublicIP(ctx, "group1", "cloud1", "publicIP1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_CreatePublicIPs.json +func ExampleWorkloadNetworksClient_BeginCreatePublicIP() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreatePublicIP(ctx, "group1", "cloud1", "publicIP1", armavs.WorkloadNetworkPublicIP{ + Properties: &armavs.WorkloadNetworkPublicIPProperties{ + DisplayName: to.Ptr("publicIP1"), + NumberOfPublicIPs: to.Ptr[int64](32), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_DeletePublicIPs.json +func ExampleWorkloadNetworksClient_BeginDeletePublicIP() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armavs.NewWorkloadNetworksClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDeletePublicIP(ctx, "group1", "publicIP1", "cloud1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_addons_client_test.go b/sdk/resourcemanager/avs/armavs/ze_generated_example_addons_client_test.go deleted file mode 100644 index f595a5f4e6e5..000000000000 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_addons_client_test.go +++ /dev/null @@ -1,125 +0,0 @@ -//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 armavs_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Addons_List.json -func ExampleAddonsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewAddonsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("group1", - "cloud1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Addons_Get_HCX.json -func ExampleAddonsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewAddonsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "group1", - "cloud1", - "hcx", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Addons_CreateOrUpdate_HCX.json -func ExampleAddonsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewAddonsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "group1", - "cloud1", - "hcx", - armavs.Addon{ - Properties: &armavs.AddonHcxProperties{ - AddonType: to.Ptr(armavs.AddonTypeHCX), - Offer: to.Ptr("VMware MaaS Cloud Provider (Enterprise)"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Addons_Delete.json -func ExampleAddonsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewAddonsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "group1", - "cloud1", - "srm", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_locations_client_test.go b/sdk/resourcemanager/avs/armavs/ze_generated_example_locations_client_test.go deleted file mode 100644 index dcfc337f6a17..000000000000 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_locations_client_test.go +++ /dev/null @@ -1,59 +0,0 @@ -//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 armavs_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Locations_CheckTrialAvailability.json -func ExampleLocationsClient_CheckTrialAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewLocationsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckTrialAvailability(ctx, - "eastus", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/Locations_CheckQuotaAvailability.json -func ExampleLocationsClient_CheckQuotaAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewLocationsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckQuotaAvailability(ctx, - "eastus", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/avs/armavs/ze_generated_example_workloadnetworks_client_test.go b/sdk/resourcemanager/avs/armavs/ze_generated_example_workloadnetworks_client_test.go deleted file mode 100644 index 8f0c59bee449..000000000000 --- a/sdk/resourcemanager/avs/armavs/ze_generated_example_workloadnetworks_client_test.go +++ /dev/null @@ -1,807 +0,0 @@ -//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 armavs_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_ListSegments.json -func ExampleWorkloadNetworksClient_NewListSegmentsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListSegmentsPager("group1", - "cloud1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_GetSegments.json -func ExampleWorkloadNetworksClient_GetSegment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetSegment(ctx, - "group1", - "cloud1", - "segment1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_CreateSegments.json -func ExampleWorkloadNetworksClient_BeginCreateSegments() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateSegments(ctx, - "group1", - "cloud1", - "segment1", - armavs.WorkloadNetworkSegment{ - Properties: &armavs.WorkloadNetworkSegmentProperties{ - ConnectedGateway: to.Ptr("/infra/tier-1s/gateway"), - DisplayName: to.Ptr("segment1"), - Revision: to.Ptr[int64](1), - Subnet: &armavs.WorkloadNetworkSegmentSubnet{ - DhcpRanges: []*string{ - to.Ptr("40.20.0.0-40.20.0.1")}, - GatewayAddress: to.Ptr("40.20.20.20/16"), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_UpdateSegments.json -func ExampleWorkloadNetworksClient_BeginUpdateSegments() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateSegments(ctx, - "group1", - "cloud1", - "segment1", - armavs.WorkloadNetworkSegment{ - Properties: &armavs.WorkloadNetworkSegmentProperties{ - ConnectedGateway: to.Ptr("/infra/tier-1s/gateway"), - Revision: to.Ptr[int64](1), - Subnet: &armavs.WorkloadNetworkSegmentSubnet{ - DhcpRanges: []*string{ - to.Ptr("40.20.0.0-40.20.0.1")}, - GatewayAddress: to.Ptr("40.20.20.20/16"), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_DeleteSegments.json -func ExampleWorkloadNetworksClient_BeginDeleteSegment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteSegment(ctx, - "group1", - "cloud1", - "segment1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_ListDhcpConfigurations.json -func ExampleWorkloadNetworksClient_NewListDhcpPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListDhcpPager("group1", - "cloud1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_GetDhcpConfigurations.json -func ExampleWorkloadNetworksClient_GetDhcp() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetDhcp(ctx, - "group1", - "dhcp1", - "cloud1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_CreateDhcpConfigurations.json -func ExampleWorkloadNetworksClient_BeginCreateDhcp() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateDhcp(ctx, - "group1", - "cloud1", - "dhcp1", - armavs.WorkloadNetworkDhcp{ - Properties: &armavs.WorkloadNetworkDhcpServer{ - DhcpType: to.Ptr(armavs.DhcpTypeEnumSERVER), - DisplayName: to.Ptr("dhcpConfigurations1"), - Revision: to.Ptr[int64](1), - LeaseTime: to.Ptr[int64](86400), - ServerAddress: to.Ptr("40.1.5.1/24"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_UpdateDhcpConfigurations.json -func ExampleWorkloadNetworksClient_BeginUpdateDhcp() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateDhcp(ctx, - "group1", - "cloud1", - "dhcp1", - armavs.WorkloadNetworkDhcp{ - Properties: &armavs.WorkloadNetworkDhcpServer{ - DhcpType: to.Ptr(armavs.DhcpTypeEnumSERVER), - Revision: to.Ptr[int64](1), - LeaseTime: to.Ptr[int64](86400), - ServerAddress: to.Ptr("40.1.5.1/24"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_DeleteDhcpConfigurations.json -func ExampleWorkloadNetworksClient_BeginDeleteDhcp() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteDhcp(ctx, - "group1", - "cloud1", - "dhcp1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_ListGateways.json -func ExampleWorkloadNetworksClient_NewListGatewaysPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListGatewaysPager("group1", - "cloud1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_GetGateway.json -func ExampleWorkloadNetworksClient_GetGateway() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetGateway(ctx, - "group1", - "cloud1", - "gateway1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_ListPortMirroringProfiles.json -func ExampleWorkloadNetworksClient_NewListPortMirroringPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPortMirroringPager("group1", - "cloud1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_GetPortMirroringProfiles.json -func ExampleWorkloadNetworksClient_GetPortMirroring() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetPortMirroring(ctx, - "group1", - "cloud1", - "portMirroring1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_CreatePortMirroringProfiles.json -func ExampleWorkloadNetworksClient_BeginCreatePortMirroring() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreatePortMirroring(ctx, - "group1", - "cloud1", - "portMirroring1", - armavs.WorkloadNetworkPortMirroring{ - Properties: &armavs.WorkloadNetworkPortMirroringProperties{ - Destination: to.Ptr("vmGroup2"), - Direction: to.Ptr(armavs.PortMirroringDirectionEnumBIDIRECTIONAL), - DisplayName: to.Ptr("portMirroring1"), - Revision: to.Ptr[int64](1), - Source: to.Ptr("vmGroup1"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_UpdatePortMirroringProfiles.json -func ExampleWorkloadNetworksClient_BeginUpdatePortMirroring() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdatePortMirroring(ctx, - "group1", - "cloud1", - "portMirroring1", - armavs.WorkloadNetworkPortMirroring{ - Properties: &armavs.WorkloadNetworkPortMirroringProperties{ - Destination: to.Ptr("vmGroup2"), - Direction: to.Ptr(armavs.PortMirroringDirectionEnumBIDIRECTIONAL), - Revision: to.Ptr[int64](1), - Source: to.Ptr("vmGroup1"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_DeletePortMirroringProfiles.json -func ExampleWorkloadNetworksClient_BeginDeletePortMirroring() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeletePortMirroring(ctx, - "group1", - "portMirroring1", - "cloud1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_ListVMGroups.json -func ExampleWorkloadNetworksClient_NewListVMGroupsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListVMGroupsPager("group1", - "cloud1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_GetVMGroups.json -func ExampleWorkloadNetworksClient_GetVMGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetVMGroup(ctx, - "group1", - "cloud1", - "vmGroup1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_CreateVMGroups.json -func ExampleWorkloadNetworksClient_BeginCreateVMGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateVMGroup(ctx, - "group1", - "cloud1", - "vmGroup1", - armavs.WorkloadNetworkVMGroup{ - Properties: &armavs.WorkloadNetworkVMGroupProperties{ - DisplayName: to.Ptr("vmGroup1"), - Members: []*string{ - to.Ptr("564d43da-fefc-2a3b-1d92-42855622fa50")}, - Revision: to.Ptr[int64](1), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_UpdateVMGroups.json -func ExampleWorkloadNetworksClient_BeginUpdateVMGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateVMGroup(ctx, - "group1", - "cloud1", - "vmGroup1", - armavs.WorkloadNetworkVMGroup{ - Properties: &armavs.WorkloadNetworkVMGroupProperties{ - Members: []*string{ - to.Ptr("564d43da-fefc-2a3b-1d92-42855622fa50")}, - Revision: to.Ptr[int64](1), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_DeleteVMGroups.json -func ExampleWorkloadNetworksClient_BeginDeleteVMGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteVMGroup(ctx, - "group1", - "vmGroup1", - "cloud1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_ListVirtualMachines.json -func ExampleWorkloadNetworksClient_NewListVirtualMachinesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListVirtualMachinesPager("group1", - "cloud1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_GetVirtualMachine.json -func ExampleWorkloadNetworksClient_GetVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetVirtualMachine(ctx, - "group1", - "cloud1", - "vm1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_ListPublicIPs.json -func ExampleWorkloadNetworksClient_NewListPublicIPsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPublicIPsPager("group1", - "cloud1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_GetPublicIPs.json -func ExampleWorkloadNetworksClient_GetPublicIP() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetPublicIP(ctx, - "group1", - "cloud1", - "publicIP1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_CreatePublicIPs.json -func ExampleWorkloadNetworksClient_BeginCreatePublicIP() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreatePublicIP(ctx, - "group1", - "cloud1", - "publicIP1", - armavs.WorkloadNetworkPublicIP{ - Properties: &armavs.WorkloadNetworkPublicIPProperties{ - DisplayName: to.Ptr("publicIP1"), - NumberOfPublicIPs: to.Ptr[int64](32), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmware/resource-manager/Microsoft.AVS/stable/2021-12-01/examples/WorkloadNetworks_DeletePublicIPs.json -func ExampleWorkloadNetworksClient_BeginDeletePublicIP() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armavs.NewWorkloadNetworksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeletePublicIP(ctx, - "group1", - "publicIP1", - "cloud1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/avs/armavs/zz_generated_models_serde.go b/sdk/resourcemanager/avs/armavs/zz_generated_models_serde.go deleted file mode 100644 index 716200d10d2a..000000000000 --- a/sdk/resourcemanager/avs/armavs/zz_generated_models_serde.go +++ /dev/null @@ -1,905 +0,0 @@ -//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 armavs - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type Addon. -func (a Addon) 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) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Addon. -func (a *Addon) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - a.Properties, err = unmarshalAddonPropertiesClassification(val) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AddonHcxProperties. -func (a AddonHcxProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["addonType"] = AddonTypeHCX - populate(objectMap, "offer", a.Offer) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AddonHcxProperties. -func (a *AddonHcxProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "addonType": - err = unpopulate(val, "AddonType", &a.AddonType) - delete(rawMsg, key) - case "offer": - err = unpopulate(val, "Offer", &a.Offer) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AddonSrmProperties. -func (a AddonSrmProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["addonType"] = AddonTypeSRM - populate(objectMap, "licenseKey", a.LicenseKey) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AddonSrmProperties. -func (a *AddonSrmProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "addonType": - err = unpopulate(val, "AddonType", &a.AddonType) - delete(rawMsg, key) - case "licenseKey": - err = unpopulate(val, "LicenseKey", &a.LicenseKey) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AddonVrProperties. -func (a AddonVrProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["addonType"] = AddonTypeVR - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "vrsCount", a.VrsCount) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AddonVrProperties. -func (a *AddonVrProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "addonType": - err = unpopulate(val, "AddonType", &a.AddonType) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - case "vrsCount": - err = unpopulate(val, "VrsCount", &a.VrsCount) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClusterProperties. -func (c ClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "clusterId", c.ClusterID) - populate(objectMap, "clusterSize", c.ClusterSize) - populate(objectMap, "hosts", c.Hosts) - populate(objectMap, "provisioningState", c.ProvisioningState) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ClusterUpdate. -func (c ClusterUpdate) 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 ClusterUpdateProperties. -func (c ClusterUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "clusterSize", c.ClusterSize) - populate(objectMap, "hosts", c.Hosts) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CommonClusterProperties. -func (c CommonClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "clusterId", c.ClusterID) - populate(objectMap, "clusterSize", c.ClusterSize) - populate(objectMap, "hosts", c.Hosts) - populate(objectMap, "provisioningState", c.ProvisioningState) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ManagementCluster. -func (m ManagementCluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "clusterId", m.ClusterID) - populate(objectMap, "clusterSize", m.ClusterSize) - populate(objectMap, "hosts", m.Hosts) - populate(objectMap, "provisioningState", m.ProvisioningState) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PSCredentialExecutionParameter. -func (p PSCredentialExecutionParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", p.Name) - populate(objectMap, "password", p.Password) - objectMap["type"] = ScriptExecutionParameterTypeCredential - populate(objectMap, "username", p.Username) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PSCredentialExecutionParameter. -func (p *PSCredentialExecutionParameter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "password": - err = unpopulate(val, "Password", &p.Password) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - case "username": - err = unpopulate(val, "Username", &p.Username) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PlacementPolicy. -func (p PlacementPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PlacementPolicy. -func (p *PlacementPolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - p.Properties, err = unmarshalPlacementPolicyPropertiesClassification(val) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PlacementPolicyUpdate. -func (p PlacementPolicyUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", p.Properties) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PlacementPolicyUpdateProperties. -func (p PlacementPolicyUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "hostMembers", p.HostMembers) - populate(objectMap, "state", p.State) - populate(objectMap, "vmMembers", p.VMMembers) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateCloud. -func (p PrivateCloud) 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, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateCloudProperties. -func (p PrivateCloudProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "availability", p.Availability) - populate(objectMap, "circuit", p.Circuit) - populate(objectMap, "encryption", p.Encryption) - populate(objectMap, "endpoints", p.Endpoints) - populate(objectMap, "externalCloudLinks", p.ExternalCloudLinks) - populate(objectMap, "identitySources", p.IdentitySources) - populate(objectMap, "internet", p.Internet) - populate(objectMap, "managementCluster", p.ManagementCluster) - populate(objectMap, "managementNetwork", p.ManagementNetwork) - populate(objectMap, "networkBlock", p.NetworkBlock) - populate(objectMap, "nsxtCertificateThumbprint", p.NsxtCertificateThumbprint) - populate(objectMap, "nsxtPassword", p.NsxtPassword) - populate(objectMap, "provisioningNetwork", p.ProvisioningNetwork) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "secondaryCircuit", p.SecondaryCircuit) - populate(objectMap, "vcenterCertificateThumbprint", p.VcenterCertificateThumbprint) - populate(objectMap, "vcenterPassword", p.VcenterPassword) - populate(objectMap, "vmotionNetwork", p.VmotionNetwork) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateCloudUpdate. -func (p PrivateCloudUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateCloudUpdateProperties. -func (p PrivateCloudUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "availability", p.Availability) - populate(objectMap, "encryption", p.Encryption) - populate(objectMap, "identitySources", p.IdentitySources) - populate(objectMap, "internet", p.Internet) - populate(objectMap, "managementCluster", p.ManagementCluster) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ScriptCmdletProperties. -func (s ScriptCmdletProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", s.Description) - populate(objectMap, "parameters", s.Parameters) - populate(objectMap, "timeout", s.Timeout) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ScriptExecutionProperties. -func (s ScriptExecutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "errors", s.Errors) - populate(objectMap, "failureReason", s.FailureReason) - populateTimeRFC3339(objectMap, "finishedAt", s.FinishedAt) - populate(objectMap, "hiddenParameters", s.HiddenParameters) - populate(objectMap, "information", s.Information) - populate(objectMap, "namedOutputs", s.NamedOutputs) - populate(objectMap, "output", s.Output) - populate(objectMap, "parameters", s.Parameters) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "retention", s.Retention) - populate(objectMap, "scriptCmdletId", s.ScriptCmdletID) - populateTimeRFC3339(objectMap, "startedAt", s.StartedAt) - populateTimeRFC3339(objectMap, "submittedAt", s.SubmittedAt) - populate(objectMap, "timeout", s.Timeout) - populate(objectMap, "warnings", s.Warnings) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptExecutionProperties. -func (s *ScriptExecutionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "errors": - err = unpopulate(val, "Errors", &s.Errors) - delete(rawMsg, key) - case "failureReason": - err = unpopulate(val, "FailureReason", &s.FailureReason) - delete(rawMsg, key) - case "finishedAt": - err = unpopulateTimeRFC3339(val, "FinishedAt", &s.FinishedAt) - delete(rawMsg, key) - case "hiddenParameters": - s.HiddenParameters, err = unmarshalScriptExecutionParameterClassificationArray(val) - delete(rawMsg, key) - case "information": - err = unpopulate(val, "Information", &s.Information) - delete(rawMsg, key) - case "namedOutputs": - err = unpopulate(val, "NamedOutputs", &s.NamedOutputs) - delete(rawMsg, key) - case "output": - err = unpopulate(val, "Output", &s.Output) - delete(rawMsg, key) - case "parameters": - s.Parameters, err = unmarshalScriptExecutionParameterClassificationArray(val) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - delete(rawMsg, key) - case "retention": - err = unpopulate(val, "Retention", &s.Retention) - delete(rawMsg, key) - case "scriptCmdletId": - err = unpopulate(val, "ScriptCmdletID", &s.ScriptCmdletID) - delete(rawMsg, key) - case "startedAt": - err = unpopulateTimeRFC3339(val, "StartedAt", &s.StartedAt) - delete(rawMsg, key) - case "submittedAt": - err = unpopulateTimeRFC3339(val, "SubmittedAt", &s.SubmittedAt) - delete(rawMsg, key) - case "timeout": - err = unpopulate(val, "Timeout", &s.Timeout) - delete(rawMsg, key) - case "warnings": - err = unpopulate(val, "Warnings", &s.Warnings) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScriptSecureStringExecutionParameter. -func (s ScriptSecureStringExecutionParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", s.Name) - populate(objectMap, "secureValue", s.SecureValue) - objectMap["type"] = ScriptExecutionParameterTypeSecureValue - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptSecureStringExecutionParameter. -func (s *ScriptSecureStringExecutionParameter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "secureValue": - err = unpopulate(val, "SecureValue", &s.SecureValue) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScriptStringExecutionParameter. -func (s ScriptStringExecutionParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", s.Name) - objectMap["type"] = ScriptExecutionParameterTypeValue - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptStringExecutionParameter. -func (s *ScriptStringExecutionParameter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, 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) -} - -// MarshalJSON implements the json.Marshaller interface for type VMHostPlacementPolicyProperties. -func (v VMHostPlacementPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "affinityType", v.AffinityType) - populate(objectMap, "displayName", v.DisplayName) - populate(objectMap, "hostMembers", v.HostMembers) - populate(objectMap, "provisioningState", v.ProvisioningState) - populate(objectMap, "state", v.State) - objectMap["type"] = PlacementPolicyTypeVMHost - populate(objectMap, "vmMembers", v.VMMembers) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VMHostPlacementPolicyProperties. -func (v *VMHostPlacementPolicyProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "affinityType": - err = unpopulate(val, "AffinityType", &v.AffinityType) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &v.DisplayName) - delete(rawMsg, key) - case "hostMembers": - err = unpopulate(val, "HostMembers", &v.HostMembers) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &v.State) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &v.Type) - delete(rawMsg, key) - case "vmMembers": - err = unpopulate(val, "VMMembers", &v.VMMembers) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type VMPlacementPolicyProperties. -func (v VMPlacementPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "affinityType", v.AffinityType) - populate(objectMap, "displayName", v.DisplayName) - populate(objectMap, "provisioningState", v.ProvisioningState) - populate(objectMap, "state", v.State) - objectMap["type"] = PlacementPolicyTypeVMVM - populate(objectMap, "vmMembers", v.VMMembers) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VMPlacementPolicyProperties. -func (v *VMPlacementPolicyProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "affinityType": - err = unpopulate(val, "AffinityType", &v.AffinityType) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &v.DisplayName) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &v.State) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &v.Type) - delete(rawMsg, key) - case "vmMembers": - err = unpopulate(val, "VMMembers", &v.VMMembers) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDNSService. -func (w WorkloadNetworkDNSService) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", w.ID) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDNSServiceProperties. -func (w WorkloadNetworkDNSServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dnsServiceIp", w.DNSServiceIP) - populate(objectMap, "defaultDnsZone", w.DefaultDNSZone) - populate(objectMap, "displayName", w.DisplayName) - populate(objectMap, "fqdnZones", w.FqdnZones) - populate(objectMap, "logLevel", w.LogLevel) - populate(objectMap, "provisioningState", w.ProvisioningState) - populate(objectMap, "revision", w.Revision) - populate(objectMap, "status", w.Status) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDNSZone. -func (w WorkloadNetworkDNSZone) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", w.ID) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDNSZoneProperties. -func (w WorkloadNetworkDNSZoneProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dnsServerIps", w.DNSServerIPs) - populate(objectMap, "dnsServices", w.DNSServices) - populate(objectMap, "displayName", w.DisplayName) - populate(objectMap, "domain", w.Domain) - populate(objectMap, "provisioningState", w.ProvisioningState) - populate(objectMap, "revision", w.Revision) - populate(objectMap, "sourceIp", w.SourceIP) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDhcp. -func (w WorkloadNetworkDhcp) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", w.ID) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDhcp. -func (w *WorkloadNetworkDhcp) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &w.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &w.Name) - delete(rawMsg, key) - case "properties": - w.Properties, err = unmarshalWorkloadNetworkDhcpEntityClassification(val) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &w.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDhcpEntity. -func (w WorkloadNetworkDhcpEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["dhcpType"] = w.DhcpType - populate(objectMap, "displayName", w.DisplayName) - populate(objectMap, "provisioningState", w.ProvisioningState) - populate(objectMap, "revision", w.Revision) - populate(objectMap, "segments", w.Segments) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDhcpRelay. -func (w WorkloadNetworkDhcpRelay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["dhcpType"] = DhcpTypeEnumRELAY - populate(objectMap, "displayName", w.DisplayName) - populate(objectMap, "provisioningState", w.ProvisioningState) - populate(objectMap, "revision", w.Revision) - populate(objectMap, "segments", w.Segments) - populate(objectMap, "serverAddresses", w.ServerAddresses) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDhcpRelay. -func (w *WorkloadNetworkDhcpRelay) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dhcpType": - err = unpopulate(val, "DhcpType", &w.DhcpType) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &w.DisplayName) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) - delete(rawMsg, key) - case "revision": - err = unpopulate(val, "Revision", &w.Revision) - delete(rawMsg, key) - case "segments": - err = unpopulate(val, "Segments", &w.Segments) - delete(rawMsg, key) - case "serverAddresses": - err = unpopulate(val, "ServerAddresses", &w.ServerAddresses) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkDhcpServer. -func (w WorkloadNetworkDhcpServer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["dhcpType"] = DhcpTypeEnumSERVER - populate(objectMap, "displayName", w.DisplayName) - populate(objectMap, "leaseTime", w.LeaseTime) - populate(objectMap, "provisioningState", w.ProvisioningState) - populate(objectMap, "revision", w.Revision) - populate(objectMap, "segments", w.Segments) - populate(objectMap, "serverAddress", w.ServerAddress) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadNetworkDhcpServer. -func (w *WorkloadNetworkDhcpServer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dhcpType": - err = unpopulate(val, "DhcpType", &w.DhcpType) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &w.DisplayName) - delete(rawMsg, key) - case "leaseTime": - err = unpopulate(val, "LeaseTime", &w.LeaseTime) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) - delete(rawMsg, key) - case "revision": - err = unpopulate(val, "Revision", &w.Revision) - delete(rawMsg, key) - case "segments": - err = unpopulate(val, "Segments", &w.Segments) - delete(rawMsg, key) - case "serverAddress": - err = unpopulate(val, "ServerAddress", &w.ServerAddress) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkPortMirroring. -func (w WorkloadNetworkPortMirroring) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", w.ID) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkSegment. -func (w WorkloadNetworkSegment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", w.ID) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkSegmentProperties. -func (w WorkloadNetworkSegmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "connectedGateway", w.ConnectedGateway) - populate(objectMap, "displayName", w.DisplayName) - populate(objectMap, "portVif", w.PortVif) - populate(objectMap, "provisioningState", w.ProvisioningState) - populate(objectMap, "revision", w.Revision) - populate(objectMap, "status", w.Status) - populate(objectMap, "subnet", w.Subnet) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkSegmentSubnet. -func (w WorkloadNetworkSegmentSubnet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dhcpRanges", w.DhcpRanges) - populate(objectMap, "gatewayAddress", w.GatewayAddress) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkVMGroup. -func (w WorkloadNetworkVMGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", w.ID) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadNetworkVMGroupProperties. -func (w WorkloadNetworkVMGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", w.DisplayName) - populate(objectMap, "members", w.Members) - populate(objectMap, "provisioningState", w.ProvisioningState) - populate(objectMap, "revision", w.Revision) - populate(objectMap, "status", w.Status) - 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, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}