diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/CHANGELOG.md b/sdk/resourcemanager/connectedvmware/armconnectedvmware/CHANGELOG.md index ede910c256da..e2fc40aca582 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/CHANGELOG.md +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/CHANGELOG.md @@ -1,5 +1,67 @@ # Release History +## 0.2.0 (2022-11-30) +### Breaking Changes + +- Function `*VirtualMachinesClient.NewListPager` parameter(s) have been changed from `(*VirtualMachinesClientListOptions)` to `(string, *VirtualMachinesClientListOptions)` +- Function `*GuestAgentsClient.NewListByVMPager` has been removed +- Function `*HybridIdentityMetadataClient.NewListByVMPager` has been removed +- Function `*VirtualMachinesClient.BeginCreate` has been removed +- Function `*VirtualMachinesClient.NewListByResourceGroupPager` has been removed +- Struct `Condition` has been removed +- Struct `ErrorDefinition` has been removed +- Struct `ErrorResponse` has been removed +- Struct `GuestAgentsClientListByVMOptions` has been removed +- Struct `GuestAgentsClientListByVMResponse` has been removed +- Struct `HybridIdentityMetadataClientListByVMOptions` has been removed +- Struct `HybridIdentityMetadataClientListByVMResponse` has been removed +- Struct `MachineExtensionInstanceView` has been removed +- Struct `ProxyResource` has been removed +- Struct `Resource` has been removed +- Struct `VirtualMachinesClientBeginCreateOptions` has been removed +- Struct `VirtualMachinesClientCreateResponse` has been removed +- Struct `VirtualMachinesClientListByResourceGroupOptions` has been removed +- Struct `VirtualMachinesClientListByResourceGroupResponse` has been removed + +### Features Added + +- New function `NewAzureArcVMwareManagementServiceAPIClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AzureArcVMwareManagementServiceAPIClient, error)` +- New function `*AzureArcVMwareManagementServiceAPIClient.BeginUpgradeExtensions(context.Context, string, string, MachineExtensionUpgrade, *AzureArcVMwareManagementServiceAPIClientBeginUpgradeExtensionsOptions) (*runtime.Poller[AzureArcVMwareManagementServiceAPIClientUpgradeExtensionsResponse], error)` +- New function `*GuestAgentsClient.NewListPager(string, string, *GuestAgentsClientListOptions) *runtime.Pager[GuestAgentsClientListResponse]` +- New function `*HybridIdentityMetadataClient.NewListPager(string, string, *HybridIdentityMetadataClientListOptions) *runtime.Pager[HybridIdentityMetadataClientListResponse]` +- New function `*VirtualMachinesClient.BeginCreateOrUpdate(context.Context, string, string, VirtualMachine, *VirtualMachinesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachinesClientCreateOrUpdateResponse], error)` +- New function `*VirtualMachinesClient.NewListAllPager(*VirtualMachinesClientListAllOptions) *runtime.Pager[VirtualMachinesClientListAllResponse]` +- New struct `AzureArcVMwareManagementServiceAPIClient` +- New struct `AzureArcVMwareManagementServiceAPIClientBeginUpgradeExtensionsOptions` +- New struct `AzureArcVMwareManagementServiceAPIClientUpgradeExtensionsResponse` +- New struct `ErrorAdditionalInfo` +- New struct `ExtensionTargetProperties` +- New struct `GuestAgentProfileUpdate` +- New struct `GuestAgentsClientListOptions` +- New struct `GuestAgentsClientListResponse` +- New struct `HybridIdentityMetadataClientListOptions` +- New struct `HybridIdentityMetadataClientListResponse` +- New struct `MachineExtensionUpgrade` +- New struct `VirtualMachinesClientBeginCreateOrUpdateOptions` +- New struct `VirtualMachinesClientCreateOrUpdateResponse` +- New struct `VirtualMachinesClientListAllOptions` +- New struct `VirtualMachinesClientListAllResponse` +- New field `CapacityGB` in struct `DatastoreProperties` +- New field `FreeSpaceGB` in struct `DatastoreProperties` +- New field `AdditionalInfo` in struct `ErrorDetail` +- New field `ClientPublicKey` in struct `GuestAgentProfile` +- New field `MssqlDiscovered` in struct `GuestAgentProfile` +- New field `DatastoreIDs` in struct `HostProperties` +- New field `NetworkIDs` in struct `HostProperties` +- New field `InventoryType` in struct `InventoryItemDetails` +- New field `DatastoreIDs` in struct `ResourcePoolProperties` +- New field `NetworkIDs` in struct `ResourcePoolProperties` +- New field `Cluster` in struct `VirtualMachineInventoryItem` +- New field `ToolsVersion` in struct `VirtualMachineTemplateInventoryItem` +- New field `ToolsVersionStatus` in struct `VirtualMachineTemplateInventoryItem` +- New field `GuestAgentProfile` in struct `VirtualMachineUpdateProperties` + + ## 0.1.0 (2022-08-09) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedvmware/armconnectedvmware` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.1.0, which contains breaking changes. diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/autorest.md b/sdk/resourcemanager/connectedvmware/armconnectedvmware/autorest.md index 52d800235dd0..3edb4fbf3171 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/autorest.md +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/specification/connectedvmware/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/specification/connectedvmware/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/connectedvmware/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/connectedvmware/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/azurearcvmwaremanagementserviceapi_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/azurearcvmwaremanagementserviceapi_client.go new file mode 100644 index 000000000000..6b5277a6efc0 --- /dev/null +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/azurearcvmwaremanagementserviceapi_client.go @@ -0,0 +1,130 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// 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 armconnectedvmware + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AzureArcVMwareManagementServiceAPIClient contains the methods for the AzureArcVMwareManagementServiceAPI group. +// Don't use this type directly, use NewAzureArcVMwareManagementServiceAPIClient() instead. +type AzureArcVMwareManagementServiceAPIClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAzureArcVMwareManagementServiceAPIClient creates a new instance of AzureArcVMwareManagementServiceAPIClient with the specified values. +// subscriptionID - The Subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAzureArcVMwareManagementServiceAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureArcVMwareManagementServiceAPIClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AzureArcVMwareManagementServiceAPIClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginUpgradeExtensions - The operation to Upgrade Machine Extensions. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-15-preview +// resourceGroupName - The Resource Group Name. +// virtualMachineName - The name of the machine containing the extension. +// extensionUpgradeParameters - Parameters supplied to the Upgrade Extensions operation. +// options - AzureArcVMwareManagementServiceAPIClientBeginUpgradeExtensionsOptions contains the optional parameters for the +// AzureArcVMwareManagementServiceAPIClient.BeginUpgradeExtensions method. +func (client *AzureArcVMwareManagementServiceAPIClient) BeginUpgradeExtensions(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionUpgradeParameters MachineExtensionUpgrade, options *AzureArcVMwareManagementServiceAPIClientBeginUpgradeExtensionsOptions) (*runtime.Poller[AzureArcVMwareManagementServiceAPIClientUpgradeExtensionsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.upgradeExtensions(ctx, resourceGroupName, virtualMachineName, extensionUpgradeParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AzureArcVMwareManagementServiceAPIClientUpgradeExtensionsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[AzureArcVMwareManagementServiceAPIClientUpgradeExtensionsResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpgradeExtensions - The operation to Upgrade Machine Extensions. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-15-preview +func (client *AzureArcVMwareManagementServiceAPIClient) upgradeExtensions(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionUpgradeParameters MachineExtensionUpgrade, options *AzureArcVMwareManagementServiceAPIClientBeginUpgradeExtensionsOptions) (*http.Response, error) { + req, err := client.upgradeExtensionsCreateRequest(ctx, resourceGroupName, virtualMachineName, extensionUpgradeParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// upgradeExtensionsCreateRequest creates the UpgradeExtensions request. +func (client *AzureArcVMwareManagementServiceAPIClient) upgradeExtensionsCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionUpgradeParameters MachineExtensionUpgrade, options *AzureArcVMwareManagementServiceAPIClientBeginUpgradeExtensionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/upgradeExtensions" + 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 virtualMachineName == "" { + return nil, errors.New("parameter virtualMachineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineName}", url.PathEscape(virtualMachineName)) + 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-07-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, extensionUpgradeParameters) +} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/clusters_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/clusters_client.go index 145df9dfe317..ff463cfee1c3 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/clusters_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/clusters_client.go @@ -66,7 +66,7 @@ func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Create Or Update cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // clusterName - Name of the cluster. // body - Request payload. @@ -87,7 +87,7 @@ func (client *ClustersClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Create Or Update cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *ClustersClient) create(ctx context.Context, resourceGroupName string, clusterName string, body Cluster, options *ClustersClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, body, options) if err != nil { @@ -123,7 +123,7 @@ func (client *ClustersClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -131,7 +131,7 @@ func (client *ClustersClient) createCreateRequest(ctx context.Context, resourceG // BeginDelete - Implements cluster DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // clusterName - Name of the cluster. // options - ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. @@ -149,7 +149,7 @@ func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Implements cluster DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { @@ -185,7 +185,7 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -196,7 +196,7 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Implements cluster GET method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // clusterName - Name of the cluster. // options - ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. @@ -235,7 +235,7 @@ func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,8 +251,7 @@ func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersCl } // NewListPager - List of clusters in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // options - ClustersClientListOptions contains the optional parameters for the ClustersClient.List method. func (client *ClustersClient) NewListPager(options *ClustersClientListOptions) *runtime.Pager[ClustersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ClustersClientListResponse]{ @@ -294,7 +293,7 @@ func (client *ClustersClient) listCreateRequest(ctx context.Context, options *Cl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -310,8 +309,7 @@ func (client *ClustersClient) listHandleResponse(resp *http.Response) (ClustersC } // NewListByResourceGroupPager - List of clusters in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // options - ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.ListByResourceGroup // method. @@ -359,7 +357,7 @@ func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -376,7 +374,7 @@ func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Respo // Update - API to update certain properties of the cluster resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // clusterName - Name of the cluster. // body - Resource properties to update. @@ -416,7 +414,7 @@ func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/clusters_client_example_test.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/clusters_client_example_test.go deleted file mode 100644 index 342d842bedb3..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/clusters_client_example_test.go +++ /dev/null @@ -1,163 +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 armconnectedvmware_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/connectedvmware/armconnectedvmware" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/CreateCluster.json -func ExampleClustersClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "testrg", "HRCluster", armconnectedvmware.Cluster{ - ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - Type: to.Ptr("customLocation"), - }, - Location: to.Ptr("East US"), - Properties: &armconnectedvmware.ClusterProperties{ - MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/GetCluster.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 := armconnectedvmware.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "HRCluster", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/UpdateCluster.json -func ExampleClustersClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "testrg", "HRCluster", armconnectedvmware.ResourcePatch{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/DeleteCluster.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 := armconnectedvmware.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "HRCluster", &armconnectedvmware.ClustersClientBeginDeleteOptions{Force: 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListClusters.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 := armconnectedvmware.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListClustersByResourceGroup.json -func ExampleClustersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", 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 - } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/constants.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/constants.go index 6c3a13c0d46a..c15264ead078 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/constants.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/constants.go @@ -19,7 +19,7 @@ package armconnectedvmware const ( moduleName = "armconnectedvmware" - moduleVersion = "v0.1.0" + moduleVersion = "v0.2.0" ) // CreatedByType - The type of identity that created the resource. diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/datastores_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/datastores_client.go index bac3866960c8..c0eeefd58f3b 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/datastores_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/datastores_client.go @@ -66,7 +66,7 @@ func NewDatastoresClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreate - Create Or Update datastore. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // datastoreName - Name of the datastore. // body - Request payload. @@ -87,7 +87,7 @@ func (client *DatastoresClient) BeginCreate(ctx context.Context, resourceGroupNa // Create - Create Or Update datastore. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *DatastoresClient) create(ctx context.Context, resourceGroupName string, datastoreName string, body Datastore, options *DatastoresClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, datastoreName, body, options) if err != nil { @@ -123,7 +123,7 @@ func (client *DatastoresClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -131,7 +131,7 @@ func (client *DatastoresClient) createCreateRequest(ctx context.Context, resourc // BeginDelete - Implements datastore DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // datastoreName - Name of the datastore. // options - DatastoresClientBeginDeleteOptions contains the optional parameters for the DatastoresClient.BeginDelete method. @@ -149,7 +149,7 @@ func (client *DatastoresClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Implements datastore DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *DatastoresClient) deleteOperation(ctx context.Context, resourceGroupName string, datastoreName string, options *DatastoresClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, datastoreName, options) if err != nil { @@ -185,7 +185,7 @@ func (client *DatastoresClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -196,7 +196,7 @@ func (client *DatastoresClient) deleteCreateRequest(ctx context.Context, resourc // Get - Implements datastore GET method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // datastoreName - Name of the datastore. // options - DatastoresClientGetOptions contains the optional parameters for the DatastoresClient.Get method. @@ -235,7 +235,7 @@ func (client *DatastoresClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,8 +251,7 @@ func (client *DatastoresClient) getHandleResponse(resp *http.Response) (Datastor } // NewListPager - List of datastores in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // options - DatastoresClientListOptions contains the optional parameters for the DatastoresClient.List method. func (client *DatastoresClient) NewListPager(options *DatastoresClientListOptions) *runtime.Pager[DatastoresClientListResponse] { return runtime.NewPager(runtime.PagingHandler[DatastoresClientListResponse]{ @@ -294,7 +293,7 @@ func (client *DatastoresClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -310,8 +309,7 @@ func (client *DatastoresClient) listHandleResponse(resp *http.Response) (Datasto } // NewListByResourceGroupPager - List of datastores in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // options - DatastoresClientListByResourceGroupOptions contains the optional parameters for the DatastoresClient.ListByResourceGroup // method. @@ -359,7 +357,7 @@ func (client *DatastoresClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -376,7 +374,7 @@ func (client *DatastoresClient) listByResourceGroupHandleResponse(resp *http.Res // Update - API to update certain properties of the datastore resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // datastoreName - Name of the datastore. // body - Resource properties to update. @@ -416,7 +414,7 @@ func (client *DatastoresClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/datastores_client_example_test.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/datastores_client_example_test.go deleted file mode 100644 index 9fc668e5435d..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/datastores_client_example_test.go +++ /dev/null @@ -1,163 +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 armconnectedvmware_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/connectedvmware/armconnectedvmware" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/CreateDatastore.json -func ExampleDatastoresClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewDatastoresClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "testrg", "HRDatastore", armconnectedvmware.Datastore{ - ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - Type: to.Ptr("customLocation"), - }, - Location: to.Ptr("East US"), - Properties: &armconnectedvmware.DatastoreProperties{ - MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/GetDatastore.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 := armconnectedvmware.NewDatastoresClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "HRDatastore", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/UpdateDatastore.json -func ExampleDatastoresClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewDatastoresClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "testrg", "HRDatastore", armconnectedvmware.ResourcePatch{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/DeleteDatastore.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 := armconnectedvmware.NewDatastoresClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "HRDatastore", &armconnectedvmware.DatastoresClientBeginDeleteOptions{Force: 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListDatastores.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 := armconnectedvmware.NewDatastoresClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListDatastoresByResourceGroup.json -func ExampleDatastoresClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewDatastoresClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", 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 - } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/go.mod b/sdk/resourcemanager/connectedvmware/armconnectedvmware/go.mod index bc22cb3944e7..d67c4d64ed68 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/go.mod +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedvmware/arm 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.1.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.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 - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/go.sum b/sdk/resourcemanager/connectedvmware/armconnectedvmware/go.sum index 8828b17b1853..3afb578030a5 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/go.sum +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/go.sum @@ -1,33 +1,15 @@ 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.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.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= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/guestagents_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/guestagents_client.go index 6b50aaf59226..19e1d7f4f9eb 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/guestagents_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/guestagents_client.go @@ -65,7 +65,7 @@ func NewGuestAgentsClient(subscriptionID string, credential azcore.TokenCredenti // BeginCreate - Create Or Update GuestAgent. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the vm. // name - Name of the guestAgents. @@ -87,7 +87,7 @@ func (client *GuestAgentsClient) BeginCreate(ctx context.Context, resourceGroupN // Create - Create Or Update GuestAgent. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *GuestAgentsClient) create(ctx context.Context, resourceGroupName string, virtualMachineName string, name string, body GuestAgent, options *GuestAgentsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, virtualMachineName, name, body, options) if err != nil { @@ -127,7 +127,7 @@ func (client *GuestAgentsClient) createCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -135,7 +135,7 @@ func (client *GuestAgentsClient) createCreateRequest(ctx context.Context, resour // BeginDelete - Implements GuestAgent DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the vm. // name - Name of the GuestAgent. @@ -154,7 +154,7 @@ func (client *GuestAgentsClient) BeginDelete(ctx context.Context, resourceGroupN // Delete - Implements GuestAgent DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *GuestAgentsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualMachineName string, name string, options *GuestAgentsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualMachineName, name, options) if err != nil { @@ -194,7 +194,7 @@ func (client *GuestAgentsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +202,7 @@ func (client *GuestAgentsClient) deleteCreateRequest(ctx context.Context, resour // Get - Implements GuestAgent GET method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the vm. // name - Name of the GuestAgent. @@ -246,7 +246,7 @@ func (client *GuestAgentsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,42 +261,41 @@ func (client *GuestAgentsClient) getHandleResponse(resp *http.Response) (GuestAg return result, nil } -// NewListByVMPager - Returns the list of GuestAgent of the given vm. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// NewListPager - Returns the list of GuestAgent of the given vm. +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the vm. -// options - GuestAgentsClientListByVMOptions contains the optional parameters for the GuestAgentsClient.ListByVM method. -func (client *GuestAgentsClient) NewListByVMPager(resourceGroupName string, virtualMachineName string, options *GuestAgentsClientListByVMOptions) *runtime.Pager[GuestAgentsClientListByVMResponse] { - return runtime.NewPager(runtime.PagingHandler[GuestAgentsClientListByVMResponse]{ - More: func(page GuestAgentsClientListByVMResponse) bool { +// options - GuestAgentsClientListOptions contains the optional parameters for the GuestAgentsClient.List method. +func (client *GuestAgentsClient) NewListPager(resourceGroupName string, virtualMachineName string, options *GuestAgentsClientListOptions) *runtime.Pager[GuestAgentsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[GuestAgentsClientListResponse]{ + More: func(page GuestAgentsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *GuestAgentsClientListByVMResponse) (GuestAgentsClientListByVMResponse, error) { + Fetcher: func(ctx context.Context, page *GuestAgentsClientListResponse) (GuestAgentsClientListResponse, error) { var req *policy.Request var err error if page == nil { - req, err = client.listByVMCreateRequest(ctx, resourceGroupName, virtualMachineName, options) + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualMachineName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { - return GuestAgentsClientListByVMResponse{}, err + return GuestAgentsClientListResponse{}, err } resp, err := client.pl.Do(req) if err != nil { - return GuestAgentsClientListByVMResponse{}, err + return GuestAgentsClientListResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return GuestAgentsClientListByVMResponse{}, runtime.NewResponseError(resp) + return GuestAgentsClientListResponse{}, runtime.NewResponseError(resp) } - return client.listByVMHandleResponse(resp) + return client.listHandleResponse(resp) }, }) } -// listByVMCreateRequest creates the ListByVM request. -func (client *GuestAgentsClient) listByVMCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *GuestAgentsClientListByVMOptions) (*policy.Request, error) { +// listCreateRequest creates the List request. +func (client *GuestAgentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *GuestAgentsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -315,17 +314,17 @@ func (client *GuestAgentsClient) listByVMCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByVMHandleResponse handles the ListByVM response. -func (client *GuestAgentsClient) listByVMHandleResponse(resp *http.Response) (GuestAgentsClientListByVMResponse, error) { - result := GuestAgentsClientListByVMResponse{} +// listHandleResponse handles the List response. +func (client *GuestAgentsClient) listHandleResponse(resp *http.Response) (GuestAgentsClientListResponse, error) { + result := GuestAgentsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.GuestAgentList); err != nil { - return GuestAgentsClientListByVMResponse{}, err + return GuestAgentsClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/guestagents_client_example_test.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/guestagents_client_example_test.go deleted file mode 100644 index 5aa7a93050d8..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/guestagents_client_example_test.go +++ /dev/null @@ -1,116 +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 armconnectedvmware_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/connectedvmware/armconnectedvmware" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/CreateGuestAgent.json -func ExampleGuestAgentsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewGuestAgentsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "testrg", "ContosoVm", "default", armconnectedvmware.GuestAgent{ - Properties: &armconnectedvmware.GuestAgentProperties{ - Credentials: &armconnectedvmware.GuestCredential{ - Password: to.Ptr(""), - Username: to.Ptr("tempuser"), - }, - HTTPProxyConfig: &armconnectedvmware.HTTPProxyConfiguration{ - HTTPSProxy: to.Ptr("http://192.1.2.3:8080"), - }, - ProvisioningAction: to.Ptr(armconnectedvmware.ProvisioningActionInstall), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/GetGuestAgent.json -func ExampleGuestAgentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewGuestAgentsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "ContosoVm", "default", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/DeleteGuestAgent.json -func ExampleGuestAgentsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewGuestAgentsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "ContosoVm", "default", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/GuestAgent_ListByVm.json -func ExampleGuestAgentsClient_NewListByVMPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewGuestAgentsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByVMPager("testrg", "ContosoVm", 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 - } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hosts_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/hosts_client.go index 5f91f0c9f594..f48848682c3c 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hosts_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/hosts_client.go @@ -66,7 +66,7 @@ func NewHostsClient(subscriptionID string, credential azcore.TokenCredential, op // BeginCreate - Create Or Update host. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // hostName - Name of the host. // body - Request payload. @@ -87,7 +87,7 @@ func (client *HostsClient) BeginCreate(ctx context.Context, resourceGroupName st // Create - Create Or Update host. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *HostsClient) create(ctx context.Context, resourceGroupName string, hostName string, body Host, options *HostsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, hostName, body, options) if err != nil { @@ -123,7 +123,7 @@ func (client *HostsClient) createCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -131,7 +131,7 @@ func (client *HostsClient) createCreateRequest(ctx context.Context, resourceGrou // BeginDelete - Implements host DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // hostName - Name of the host. // options - HostsClientBeginDeleteOptions contains the optional parameters for the HostsClient.BeginDelete method. @@ -149,7 +149,7 @@ func (client *HostsClient) BeginDelete(ctx context.Context, resourceGroupName st // Delete - Implements host DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *HostsClient) deleteOperation(ctx context.Context, resourceGroupName string, hostName string, options *HostsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostName, options) if err != nil { @@ -185,7 +185,7 @@ func (client *HostsClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -196,7 +196,7 @@ func (client *HostsClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Implements host GET method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // hostName - Name of the host. // options - HostsClientGetOptions contains the optional parameters for the HostsClient.Get method. @@ -235,7 +235,7 @@ func (client *HostsClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,8 +251,7 @@ func (client *HostsClient) getHandleResponse(resp *http.Response) (HostsClientGe } // NewListPager - List of hosts in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // options - HostsClientListOptions contains the optional parameters for the HostsClient.List method. func (client *HostsClient) NewListPager(options *HostsClientListOptions) *runtime.Pager[HostsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[HostsClientListResponse]{ @@ -294,7 +293,7 @@ func (client *HostsClient) listCreateRequest(ctx context.Context, options *Hosts return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -310,8 +309,7 @@ func (client *HostsClient) listHandleResponse(resp *http.Response) (HostsClientL } // NewListByResourceGroupPager - List of hosts in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // options - HostsClientListByResourceGroupOptions contains the optional parameters for the HostsClient.ListByResourceGroup // method. @@ -359,7 +357,7 @@ func (client *HostsClient) listByResourceGroupCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -376,7 +374,7 @@ func (client *HostsClient) listByResourceGroupHandleResponse(resp *http.Response // Update - API to update certain properties of the host resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // hostName - Name of the host. // body - Resource properties to update. @@ -416,7 +414,7 @@ func (client *HostsClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hosts_client_example_test.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/hosts_client_example_test.go deleted file mode 100644 index 0414b88490bc..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hosts_client_example_test.go +++ /dev/null @@ -1,163 +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 armconnectedvmware_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/connectedvmware/armconnectedvmware" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/CreateHost.json -func ExampleHostsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewHostsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "testrg", "HRHost", armconnectedvmware.Host{ - ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - Type: to.Ptr("customLocation"), - }, - Location: to.Ptr("East US"), - Properties: &armconnectedvmware.HostProperties{ - MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/GetHost.json -func ExampleHostsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewHostsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "HRHost", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/UpdateHost.json -func ExampleHostsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewHostsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "testrg", "HRHost", armconnectedvmware.ResourcePatch{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/DeleteHost.json -func ExampleHostsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewHostsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "HRHost", &armconnectedvmware.HostsClientBeginDeleteOptions{Force: 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListHosts.json -func ExampleHostsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewHostsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListHostsByResourceGroup.json -func ExampleHostsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewHostsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", 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 - } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hybrididentitymetadata_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/hybrididentitymetadata_client.go index f8d5d986f5a6..e0528cf465b0 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hybrididentitymetadata_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/hybrididentitymetadata_client.go @@ -65,7 +65,7 @@ func NewHybridIdentityMetadataClient(subscriptionID string, credential azcore.To // Create - Create Or Update HybridIdentityMetadata. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the vm. // metadataName - Name of the hybridIdentityMetadata. @@ -111,7 +111,7 @@ func (client *HybridIdentityMetadataClient) createCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -128,7 +128,7 @@ func (client *HybridIdentityMetadataClient) createHandleResponse(resp *http.Resp // Delete - Implements HybridIdentityMetadata DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the vm. // metadataName - Name of the HybridIdentityMetadata. @@ -173,7 +173,7 @@ func (client *HybridIdentityMetadataClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,7 +181,7 @@ func (client *HybridIdentityMetadataClient) deleteCreateRequest(ctx context.Cont // Get - Implements HybridIdentityMetadata GET method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the vm. // metadataName - Name of the HybridIdentityMetadata. @@ -226,7 +226,7 @@ func (client *HybridIdentityMetadataClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -241,43 +241,42 @@ func (client *HybridIdentityMetadataClient) getHandleResponse(resp *http.Respons return result, nil } -// NewListByVMPager - Returns the list of HybridIdentityMetadata of the given vm. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// NewListPager - Returns the list of HybridIdentityMetadata of the given vm. +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the vm. -// options - HybridIdentityMetadataClientListByVMOptions contains the optional parameters for the HybridIdentityMetadataClient.ListByVM +// options - HybridIdentityMetadataClientListOptions contains the optional parameters for the HybridIdentityMetadataClient.List // method. -func (client *HybridIdentityMetadataClient) NewListByVMPager(resourceGroupName string, virtualMachineName string, options *HybridIdentityMetadataClientListByVMOptions) *runtime.Pager[HybridIdentityMetadataClientListByVMResponse] { - return runtime.NewPager(runtime.PagingHandler[HybridIdentityMetadataClientListByVMResponse]{ - More: func(page HybridIdentityMetadataClientListByVMResponse) bool { +func (client *HybridIdentityMetadataClient) NewListPager(resourceGroupName string, virtualMachineName string, options *HybridIdentityMetadataClientListOptions) *runtime.Pager[HybridIdentityMetadataClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[HybridIdentityMetadataClientListResponse]{ + More: func(page HybridIdentityMetadataClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *HybridIdentityMetadataClientListByVMResponse) (HybridIdentityMetadataClientListByVMResponse, error) { + Fetcher: func(ctx context.Context, page *HybridIdentityMetadataClientListResponse) (HybridIdentityMetadataClientListResponse, error) { var req *policy.Request var err error if page == nil { - req, err = client.listByVMCreateRequest(ctx, resourceGroupName, virtualMachineName, options) + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualMachineName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { - return HybridIdentityMetadataClientListByVMResponse{}, err + return HybridIdentityMetadataClientListResponse{}, err } resp, err := client.pl.Do(req) if err != nil { - return HybridIdentityMetadataClientListByVMResponse{}, err + return HybridIdentityMetadataClientListResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return HybridIdentityMetadataClientListByVMResponse{}, runtime.NewResponseError(resp) + return HybridIdentityMetadataClientListResponse{}, runtime.NewResponseError(resp) } - return client.listByVMHandleResponse(resp) + return client.listHandleResponse(resp) }, }) } -// listByVMCreateRequest creates the ListByVM request. -func (client *HybridIdentityMetadataClient) listByVMCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *HybridIdentityMetadataClientListByVMOptions) (*policy.Request, error) { +// listCreateRequest creates the List request. +func (client *HybridIdentityMetadataClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *HybridIdentityMetadataClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -296,17 +295,17 @@ func (client *HybridIdentityMetadataClient) listByVMCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByVMHandleResponse handles the ListByVM response. -func (client *HybridIdentityMetadataClient) listByVMHandleResponse(resp *http.Response) (HybridIdentityMetadataClientListByVMResponse, error) { - result := HybridIdentityMetadataClientListByVMResponse{} +// listHandleResponse handles the List response. +func (client *HybridIdentityMetadataClient) listHandleResponse(resp *http.Response) (HybridIdentityMetadataClientListResponse, error) { + result := HybridIdentityMetadataClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.HybridIdentityMetadataList); err != nil { - return HybridIdentityMetadataClientListByVMResponse{}, err + return HybridIdentityMetadataClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hybrididentitymetadata_client_example_test.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/hybrididentitymetadata_client_example_test.go deleted file mode 100644 index 91659c822099..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hybrididentitymetadata_client_example_test.go +++ /dev/null @@ -1,102 +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 armconnectedvmware_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/connectedvmware/armconnectedvmware" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/CreateHybridIdentityMetadata.json -func ExampleHybridIdentityMetadataClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewHybridIdentityMetadataClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "testrg", "ContosoVm", "default", armconnectedvmware.HybridIdentityMetadata{ - Properties: &armconnectedvmware.HybridIdentityMetadataProperties{ - PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), - VMID: to.Ptr("f8b82dff-38ef-4220-99ef-d3a3f86ddc6c"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/GetHybridIdentityMetadata.json -func ExampleHybridIdentityMetadataClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewHybridIdentityMetadataClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "ContosoVm", "default", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/DeleteHybridIdentityMetadata.json -func ExampleHybridIdentityMetadataClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewHybridIdentityMetadataClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "testrg", "ContosoVm", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/HybridIdentityMetadata_ListByVm.json -func ExampleHybridIdentityMetadataClient_NewListByVMPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewHybridIdentityMetadataClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByVMPager("testrg", "ContosoVm", 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 - } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/inventoryitems_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/inventoryitems_client.go index 5402eb24c436..feabc4c91b97 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/inventoryitems_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/inventoryitems_client.go @@ -65,7 +65,7 @@ func NewInventoryItemsClient(subscriptionID string, credential azcore.TokenCrede // Create - Create Or Update InventoryItem. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // vcenterName - Name of the vCenter. // inventoryItemName - Name of the inventoryItem. @@ -110,7 +110,7 @@ func (client *InventoryItemsClient) createCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -127,7 +127,7 @@ func (client *InventoryItemsClient) createHandleResponse(resp *http.Response) (I // Delete - Implements inventoryItem DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // vcenterName - Name of the vCenter. // inventoryItemName - Name of the inventoryItem. @@ -171,7 +171,7 @@ func (client *InventoryItemsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -179,7 +179,7 @@ func (client *InventoryItemsClient) deleteCreateRequest(ctx context.Context, res // Get - Implements InventoryItem GET method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // vcenterName - Name of the vCenter. // inventoryItemName - Name of the inventoryItem. @@ -223,7 +223,7 @@ func (client *InventoryItemsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -239,8 +239,7 @@ func (client *InventoryItemsClient) getHandleResponse(resp *http.Response) (Inve } // NewListByVCenterPager - Returns the list of inventoryItems of the given vCenter. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // vcenterName - Name of the vCenter. // options - InventoryItemsClientListByVCenterOptions contains the optional parameters for the InventoryItemsClient.ListByVCenter @@ -293,7 +292,7 @@ func (client *InventoryItemsClient) listByVCenterCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/inventoryitems_client_example_test.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/inventoryitems_client_example_test.go deleted file mode 100644 index d9641d6bac31..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/inventoryitems_client_example_test.go +++ /dev/null @@ -1,101 +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 armconnectedvmware_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/connectedvmware/armconnectedvmware" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/CreateInventoryItem.json -func ExampleInventoryItemsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewInventoryItemsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "testrg", "ContosoVCenter", "testItem", armconnectedvmware.InventoryItem{ - Properties: &armconnectedvmware.ResourcePoolInventoryItem{ - InventoryType: to.Ptr(armconnectedvmware.InventoryTypeResourcePool), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/GetInventoryItem.json -func ExampleInventoryItemsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewInventoryItemsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "ContosoVCenter", "testItem", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/DeleteInventoryItem.json -func ExampleInventoryItemsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewInventoryItemsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "testrg", "ContosoVCenter", "testItem", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/InventoryItems_ListByVCenter.json -func ExampleInventoryItemsClient_NewListByVCenterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewInventoryItemsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByVCenterPager("testrg", "ContosoVCenter", 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 - } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/machineextensions_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/machineextensions_client.go index 6da8e511624a..2446d2829185 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/machineextensions_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/machineextensions_client.go @@ -65,16 +65,16 @@ func NewMachineExtensionsClient(subscriptionID string, credential azcore.TokenCr // BeginCreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. -// name - The name of the machine where the extension should be created or updated. +// virtualMachineName - The name of the machine where the extension should be created or updated. // extensionName - The name of the machine extension. // extensionParameters - Parameters supplied to the Create Machine Extension operation. // options - MachineExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginCreateOrUpdate // method. -func (client *MachineExtensionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, name string, extensionName string, extensionParameters MachineExtension, options *MachineExtensionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[MachineExtensionsClientCreateOrUpdateResponse], error) { +func (client *MachineExtensionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionName string, extensionParameters MachineExtension, options *MachineExtensionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[MachineExtensionsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, name, extensionName, extensionParameters, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualMachineName, extensionName, extensionParameters, options) if err != nil { return nil, err } @@ -88,9 +88,9 @@ func (client *MachineExtensionsClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview -func (client *MachineExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, name string, extensionName string, extensionParameters MachineExtension, options *MachineExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, name, extensionName, extensionParameters, options) +// Generated from API version 2022-07-15-preview +func (client *MachineExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionName string, extensionParameters MachineExtension, options *MachineExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualMachineName, extensionName, extensionParameters, options) if err != nil { return nil, err } @@ -105,8 +105,8 @@ func (client *MachineExtensionsClient) createOrUpdate(ctx context.Context, resou } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *MachineExtensionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, name string, extensionName string, extensionParameters MachineExtension, options *MachineExtensionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/extensions/{extensionName}" +func (client *MachineExtensionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionName string, extensionParameters MachineExtension, options *MachineExtensionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -115,10 +115,10 @@ func (client *MachineExtensionsClient) createOrUpdateCreateRequest(ctx context.C return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") + if virtualMachineName == "" { + return nil, errors.New("parameter virtualMachineName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineName}", url.PathEscape(virtualMachineName)) if extensionName == "" { return nil, errors.New("parameter extensionName cannot be empty") } @@ -128,7 +128,7 @@ func (client *MachineExtensionsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) @@ -136,15 +136,15 @@ func (client *MachineExtensionsClient) createOrUpdateCreateRequest(ctx context.C // BeginDelete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. -// name - The name of the machine where the extension should be deleted. +// virtualMachineName - The name of the machine where the extension should be deleted. // extensionName - The name of the machine extension. // options - MachineExtensionsClientBeginDeleteOptions contains the optional parameters for the MachineExtensionsClient.BeginDelete // method. -func (client *MachineExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, name string, extensionName string, options *MachineExtensionsClientBeginDeleteOptions) (*runtime.Poller[MachineExtensionsClientDeleteResponse], error) { +func (client *MachineExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionName string, options *MachineExtensionsClientBeginDeleteOptions) (*runtime.Poller[MachineExtensionsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, name, extensionName, options) + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualMachineName, extensionName, options) if err != nil { return nil, err } @@ -156,9 +156,9 @@ func (client *MachineExtensionsClient) BeginDelete(ctx context.Context, resource // Delete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview -func (client *MachineExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, name string, extensionName string, options *MachineExtensionsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, name, extensionName, options) +// Generated from API version 2022-07-15-preview +func (client *MachineExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionName string, options *MachineExtensionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualMachineName, extensionName, options) if err != nil { return nil, err } @@ -173,8 +173,8 @@ func (client *MachineExtensionsClient) deleteOperation(ctx context.Context, reso } // deleteCreateRequest creates the Delete request. -func (client *MachineExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, name string, extensionName string, options *MachineExtensionsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/extensions/{extensionName}" +func (client *MachineExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionName string, options *MachineExtensionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -183,10 +183,10 @@ func (client *MachineExtensionsClient) deleteCreateRequest(ctx context.Context, return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") + if virtualMachineName == "" { + return nil, errors.New("parameter virtualMachineName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineName}", url.PathEscape(virtualMachineName)) if extensionName == "" { return nil, errors.New("parameter extensionName cannot be empty") } @@ -196,7 +196,7 @@ func (client *MachineExtensionsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,13 +204,13 @@ func (client *MachineExtensionsClient) deleteCreateRequest(ctx context.Context, // Get - The operation to get the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. -// name - The name of the machine containing the extension. +// virtualMachineName - The name of the machine containing the extension. // extensionName - The name of the machine extension. // options - MachineExtensionsClientGetOptions contains the optional parameters for the MachineExtensionsClient.Get method. -func (client *MachineExtensionsClient) Get(ctx context.Context, resourceGroupName string, name string, extensionName string, options *MachineExtensionsClientGetOptions) (MachineExtensionsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, name, extensionName, options) +func (client *MachineExtensionsClient) Get(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionName string, options *MachineExtensionsClientGetOptions) (MachineExtensionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualMachineName, extensionName, options) if err != nil { return MachineExtensionsClientGetResponse{}, err } @@ -225,8 +225,8 @@ func (client *MachineExtensionsClient) Get(ctx context.Context, resourceGroupNam } // getCreateRequest creates the Get request. -func (client *MachineExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, name string, extensionName string, options *MachineExtensionsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/extensions/{extensionName}" +func (client *MachineExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionName string, options *MachineExtensionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -235,10 +235,10 @@ func (client *MachineExtensionsClient) getCreateRequest(ctx context.Context, res return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") + if virtualMachineName == "" { + return nil, errors.New("parameter virtualMachineName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineName}", url.PathEscape(virtualMachineName)) if extensionName == "" { return nil, errors.New("parameter extensionName cannot be empty") } @@ -248,7 +248,7 @@ func (client *MachineExtensionsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -264,12 +264,11 @@ func (client *MachineExtensionsClient) getHandleResponse(resp *http.Response) (M } // NewListPager - The operation to get all extensions of a non-Azure machine -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. -// name - The name of the machine containing the extension. +// virtualMachineName - The name of the machine containing the extension. // options - MachineExtensionsClientListOptions contains the optional parameters for the MachineExtensionsClient.List method. -func (client *MachineExtensionsClient) NewListPager(resourceGroupName string, name string, options *MachineExtensionsClientListOptions) *runtime.Pager[MachineExtensionsClientListResponse] { +func (client *MachineExtensionsClient) NewListPager(resourceGroupName string, virtualMachineName string, options *MachineExtensionsClientListOptions) *runtime.Pager[MachineExtensionsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[MachineExtensionsClientListResponse]{ More: func(page MachineExtensionsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -278,7 +277,7 @@ func (client *MachineExtensionsClient) NewListPager(resourceGroupName string, na var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, name, options) + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualMachineName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } @@ -298,8 +297,8 @@ func (client *MachineExtensionsClient) NewListPager(resourceGroupName string, na } // listCreateRequest creates the List request. -func (client *MachineExtensionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, name string, options *MachineExtensionsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/extensions" +func (client *MachineExtensionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *MachineExtensionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -308,16 +307,16 @@ func (client *MachineExtensionsClient) listCreateRequest(ctx context.Context, re return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") + if virtualMachineName == "" { + return nil, errors.New("parameter virtualMachineName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineName}", url.PathEscape(virtualMachineName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -337,16 +336,16 @@ func (client *MachineExtensionsClient) listHandleResponse(resp *http.Response) ( // BeginUpdate - The operation to update the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. -// name - The name of the machine where the extension should be created or updated. +// virtualMachineName - The name of the machine where the extension should be created or updated. // extensionName - The name of the machine extension. // extensionParameters - Parameters supplied to the Create Machine Extension operation. // options - MachineExtensionsClientBeginUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginUpdate // method. -func (client *MachineExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, name string, extensionName string, extensionParameters MachineExtensionUpdate, options *MachineExtensionsClientBeginUpdateOptions) (*runtime.Poller[MachineExtensionsClientUpdateResponse], error) { +func (client *MachineExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionName string, extensionParameters MachineExtensionUpdate, options *MachineExtensionsClientBeginUpdateOptions) (*runtime.Poller[MachineExtensionsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, name, extensionName, extensionParameters, options) + resp, err := client.update(ctx, resourceGroupName, virtualMachineName, extensionName, extensionParameters, options) if err != nil { return nil, err } @@ -358,9 +357,9 @@ func (client *MachineExtensionsClient) BeginUpdate(ctx context.Context, resource // Update - The operation to update the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview -func (client *MachineExtensionsClient) update(ctx context.Context, resourceGroupName string, name string, extensionName string, extensionParameters MachineExtensionUpdate, options *MachineExtensionsClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, name, extensionName, extensionParameters, options) +// Generated from API version 2022-07-15-preview +func (client *MachineExtensionsClient) update(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionName string, extensionParameters MachineExtensionUpdate, options *MachineExtensionsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, virtualMachineName, extensionName, extensionParameters, options) if err != nil { return nil, err } @@ -375,8 +374,8 @@ func (client *MachineExtensionsClient) update(ctx context.Context, resourceGroup } // updateCreateRequest creates the Update request. -func (client *MachineExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, name string, extensionName string, extensionParameters MachineExtensionUpdate, options *MachineExtensionsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/extensions/{extensionName}" +func (client *MachineExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, extensionName string, extensionParameters MachineExtensionUpdate, options *MachineExtensionsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -385,10 +384,10 @@ func (client *MachineExtensionsClient) updateCreateRequest(ctx context.Context, return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") + if virtualMachineName == "" { + return nil, errors.New("parameter virtualMachineName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineName}", url.PathEscape(virtualMachineName)) if extensionName == "" { return nil, errors.New("parameter extensionName cannot be empty") } @@ -398,7 +397,7 @@ func (client *MachineExtensionsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/machineextensions_client_example_test.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/machineextensions_client_example_test.go deleted file mode 100644 index f5062e35f755..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/machineextensions_client_example_test.go +++ /dev/null @@ -1,147 +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 armconnectedvmware_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/connectedvmware/armconnectedvmware" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/PUTExtension.json -func ExampleMachineExtensionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewMachineExtensionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myMachine", "CustomScriptExtension", armconnectedvmware.MachineExtension{ - Location: to.Ptr("eastus2euap"), - Properties: &armconnectedvmware.MachineExtensionProperties{ - Type: to.Ptr("CustomScriptExtension"), - Publisher: to.Ptr("Microsoft.Compute"), - Settings: map[string]interface{}{ - "commandToExecute": "powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"", - }, - TypeHandlerVersion: to.Ptr("1.10"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/UpdateExtension.json -func ExampleMachineExtensionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewMachineExtensionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myMachine", "CustomScriptExtension", armconnectedvmware.MachineExtensionUpdate{ - Properties: &armconnectedvmware.MachineExtensionUpdateProperties{ - Type: to.Ptr("CustomScriptExtension"), - Publisher: to.Ptr("Microsoft.Compute"), - Settings: map[string]interface{}{ - "commandToExecute": "powershell.exe -c \"Get-Process | Where-Object { $_.CPU -lt 100 }\"", - }, - TypeHandlerVersion: to.Ptr("1.10"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/DELETEExtension.json -func ExampleMachineExtensionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewMachineExtensionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myMachine", "MMA", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/GETExtension.json -func ExampleMachineExtensionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewMachineExtensionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myMachine", "CustomScriptExtension", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/LISTExtension.json -func ExampleMachineExtensionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewMachineExtensionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", "myMachine", &armconnectedvmware.MachineExtensionsClientListOptions{Expand: 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 - } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/models.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/models.go index 5b3c4d8bf206..aff576ec8a41 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/models.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/models.go @@ -49,6 +49,13 @@ type AvailablePatchCountByClassification struct { Updates *int32 `json:"updates,omitempty" azure:"ro"` } +// AzureArcVMwareManagementServiceAPIClientBeginUpgradeExtensionsOptions contains the optional parameters for the AzureArcVMwareManagementServiceAPIClient.BeginUpgradeExtensions +// method. +type AzureArcVMwareManagementServiceAPIClientBeginUpgradeExtensionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // Cluster - Define the cluster. type Cluster struct { // REQUIRED; Gets or sets the location. @@ -110,7 +117,7 @@ func (c *ClusterInventoryItem) GetInventoryItemProperties() *InventoryItemProper } } -// ClusterProperties - Defines the resource properties. +// ClusterProperties - Describes the properties of a Cluster. type ClusterProperties struct { // Gets or sets the inventory Item ID for the cluster. InventoryItemID *string `json:"inventoryItemId,omitempty"` @@ -186,21 +193,6 @@ type ClustersList struct { NextLink *string `json:"nextLink,omitempty"` } -// Condition defines an extension to status. -type Condition struct { - // READ-ONLY; A human readable message indicating details about the status. - Message *string `json:"message,omitempty" azure:"ro"` - - // READ-ONLY; The reason for the condition's status. - Reason *string `json:"reason,omitempty" azure:"ro"` - - // READ-ONLY; Severity with which to treat failures of this type of condition. - Severity *string `json:"severity,omitempty" azure:"ro"` - - // READ-ONLY; Status of the condition. - Status *string `json:"status,omitempty" azure:"ro"` -} - // Datastore - Define the datastore. type Datastore struct { // REQUIRED; Gets or sets the location. @@ -268,7 +260,7 @@ func (d *DatastoreInventoryItem) GetInventoryItemProperties() *InventoryItemProp } } -// DatastoreProperties - Defines the resource properties. +// DatastoreProperties - Describes the properties of a Datastore. type DatastoreProperties struct { // Gets or sets the inventory Item ID for the datastore. InventoryItemID *string `json:"inventoryItemId,omitempty"` @@ -279,9 +271,15 @@ type DatastoreProperties struct { // Gets or sets the ARM Id of the vCenter resource in which this datastore resides. VCenterID *string `json:"vCenterId,omitempty"` + // READ-ONLY; Gets or sets Maximum capacity of this datastore in GBs. + CapacityGB *int64 `json:"capacityGB,omitempty" azure:"ro"` + // READ-ONLY; Gets the name of the corresponding resource in Kubernetes. CustomResourceName *string `json:"customResourceName,omitempty" azure:"ro"` + // READ-ONLY; Gets or sets Available space of this datastore in GBs. + FreeSpaceGB *int64 `json:"freeSpaceGB,omitempty" azure:"ro"` + // READ-ONLY; Gets or sets the vCenter Managed Object name for the datastore. MoName *string `json:"moName,omitempty" azure:"ro"` @@ -339,37 +337,31 @@ type DatastoresList struct { NextLink *string `json:"nextLink,omitempty"` } -// ErrorDefinition - Error definition. -type ErrorDefinition struct { - // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; Internal error details. - Details []*ErrorDefinition `json:"details,omitempty" azure:"ro"` +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty" azure:"ro"` - // READ-ONLY; Description of the error. - Message *string `json:"message,omitempty" azure:"ro"` + // READ-ONLY; The additional info type. + Type *string `json:"type,omitempty" azure:"ro"` } -// ErrorDetail - Error details. +// ErrorDetail - The error detail. type ErrorDetail struct { - // REQUIRED; The error's code. - Code *string `json:"code,omitempty"` + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` - // REQUIRED; A human readable error message. - Message *string `json:"message,omitempty"` + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` - // Additional error details. - Details []*ErrorDetail `json:"details,omitempty"` + // READ-ONLY; The error details. + Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` - // Indicates which property in the request is responsible for the error. - Target *string `json:"target,omitempty"` -} + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` -// ErrorResponse - Error response. -type ErrorResponse struct { - // The error details. - Error *ErrorDefinition `json:"error,omitempty"` + // READ-ONLY; The error target. + Target *string `json:"target,omitempty" azure:"ro"` } // ExtendedLocation - The extended location. @@ -381,6 +373,12 @@ type ExtendedLocation struct { Type *string `json:"type,omitempty"` } +// ExtensionTargetProperties - Describes the Machine Extension Target Version Properties +type ExtensionTargetProperties struct { + // Properties for the specified Extension to Upgrade. + TargetVersion *string `json:"targetVersion,omitempty"` +} + // GuestAgent - Defines the GuestAgent. type GuestAgent struct { // REQUIRED; Resource properties. @@ -408,8 +406,11 @@ type GuestAgentList struct { NextLink *string `json:"nextLink,omitempty"` } -// GuestAgentProfile - Defines the resource properties. +// GuestAgentProfile - Specifies the guest agent settings for the virtual machine. type GuestAgentProfile struct { + // Gets or sets the Public Key provided by the client for enabling guest management. + ClientPublicKey *string `json:"clientPublicKey,omitempty"` + // READ-ONLY; The hybrid machine agent full version. AgentVersion *string `json:"agentVersion,omitempty" azure:"ro"` @@ -419,6 +420,9 @@ type GuestAgentProfile struct { // READ-ONLY; The time of the last status change. LastStatusChange *time.Time `json:"lastStatusChange,omitempty" azure:"ro"` + // READ-ONLY; Specifies whether any MS SQL instance is discovered on the machine. + MssqlDiscovered *string `json:"mssqlDiscovered,omitempty" azure:"ro"` + // READ-ONLY; The status of the hybrid machine agent. Status *StatusTypes `json:"status,omitempty" azure:"ro"` @@ -426,7 +430,13 @@ type GuestAgentProfile struct { VMUUID *string `json:"vmUuid,omitempty" azure:"ro"` } -// GuestAgentProperties - Defines the resource properties. +// GuestAgentProfileUpdate - Specifies the guest agent settings for the virtual machine. +type GuestAgentProfileUpdate struct { + // Gets or sets the Public Key provided by the client for enabling guest management. + ClientPublicKey *string `json:"clientPublicKey,omitempty"` +} + +// GuestAgentProperties - Describes the properties of a Virtual Machine Guest Agent. type GuestAgentProperties struct { // Username / Password Credentials to provision guest agent. Credentials *GuestCredential `json:"credentials,omitempty"` @@ -470,8 +480,8 @@ type GuestAgentsClientGetOptions struct { // placeholder for future optional parameters } -// GuestAgentsClientListByVMOptions contains the optional parameters for the GuestAgentsClient.ListByVM method. -type GuestAgentsClientListByVMOptions struct { +// GuestAgentsClientListOptions contains the optional parameters for the GuestAgentsClient.List method. +type GuestAgentsClientListOptions struct { // placeholder for future optional parameters } @@ -490,7 +500,7 @@ type HTTPProxyConfiguration struct { HTTPSProxy *string `json:"httpsProxy,omitempty"` } -// HardwareProfile - Defines the resource properties. +// HardwareProfile - Specifies the hardware settings for the virtual machine. type HardwareProfile struct { // Gets or sets memory size in MBs for the vm. MemorySizeMB *int32 `json:"memorySizeMB,omitempty"` @@ -575,7 +585,7 @@ func (h *HostInventoryItem) GetInventoryItemProperties() *InventoryItemPropertie } } -// HostProperties - Defines the resource properties. +// HostProperties - Describes the properties of a Host. type HostProperties struct { // Gets or sets the inventory Item ID for the host. InventoryItemID *string `json:"inventoryItemId,omitempty"` @@ -589,9 +599,15 @@ type HostProperties struct { // READ-ONLY; Gets the name of the corresponding resource in Kubernetes. CustomResourceName *string `json:"customResourceName,omitempty" azure:"ro"` + // READ-ONLY; Gets or sets the datastore ARM ids. + DatastoreIDs []*string `json:"datastoreIds,omitempty" azure:"ro"` + // READ-ONLY; Gets or sets the vCenter Managed Object name for the host. MoName *string `json:"moName,omitempty" azure:"ro"` + // READ-ONLY; Gets or sets the network ARM ids. + NetworkIDs []*string `json:"networkIds,omitempty" azure:"ro"` + // READ-ONLY; Gets or sets the provisioning state. ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` @@ -680,9 +696,8 @@ type HybridIdentityMetadataClientGetOptions struct { // placeholder for future optional parameters } -// HybridIdentityMetadataClientListByVMOptions contains the optional parameters for the HybridIdentityMetadataClient.ListByVM -// method. -type HybridIdentityMetadataClientListByVMOptions struct { +// HybridIdentityMetadataClientListOptions contains the optional parameters for the HybridIdentityMetadataClient.List method. +type HybridIdentityMetadataClientListOptions struct { // placeholder for future optional parameters } @@ -695,7 +710,7 @@ type HybridIdentityMetadataList struct { NextLink *string `json:"nextLink,omitempty"` } -// HybridIdentityMetadataProperties - Defines the resource properties. +// HybridIdentityMetadataProperties - Describes the properties of Hybrid Identity Metadata for a Virtual Machine. type HybridIdentityMetadataProperties struct { // Gets or sets the Public Key. PublicKey *string `json:"publicKey,omitempty"` @@ -745,11 +760,14 @@ type InventoryItem struct { Type *string `json:"type,omitempty" azure:"ro"` } -// InventoryItemDetails - Defines the resource properties. +// InventoryItemDetails - Describes the properties of an Inventory Item reference. type InventoryItemDetails struct { // Gets or sets the inventory Item ID for the resource. InventoryItemID *string `json:"inventoryItemId,omitempty"` + // The inventory type. + InventoryType *InventoryType `json:"inventoryType,omitempty"` + // Gets or sets the vCenter Managed Object name for the resource. MoName *string `json:"moName,omitempty"` } @@ -764,7 +782,7 @@ type InventoryItemPropertiesClassification interface { GetInventoryItemProperties() *InventoryItemProperties } -// InventoryItemProperties - Defines the resource properties. +// InventoryItemProperties - Describes the properties of an Inventory Item. type InventoryItemProperties struct { // REQUIRED; They inventory type. InventoryType *InventoryType `json:"inventoryType,omitempty"` @@ -850,21 +868,6 @@ type MachineExtension struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MachineExtensionInstanceView - Describes the Machine Extension Instance View. -type MachineExtensionInstanceView struct { - // Instance view status. - Status *MachineExtensionInstanceViewStatus `json:"status,omitempty"` - - // READ-ONLY; The machine extension name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Specifies the type of the extension; an example is "CustomScriptExtension". - Type *string `json:"type,omitempty" azure:"ro"` - - // READ-ONLY; Specifies the version of the script handler. - TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty" azure:"ro"` -} - // MachineExtensionInstanceViewStatus - Instance view status. type MachineExtensionInstanceViewStatus struct { // READ-ONLY; The status code. @@ -971,6 +974,12 @@ type MachineExtensionUpdateProperties struct { TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` } +// MachineExtensionUpgrade - Describes the Machine Extension Upgrade Properties +type MachineExtensionUpgrade struct { + // Describes the Extension Target Properties. + ExtensionTargets map[string]*ExtensionTargetProperties `json:"extensionTargets,omitempty"` +} + // MachineExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginCreateOrUpdate // method. type MachineExtensionsClientBeginCreateOrUpdateOptions struct { @@ -1067,13 +1076,13 @@ type NetworkInterfaceUpdate struct { PowerOnBoot *PowerOnBootOption `json:"powerOnBoot,omitempty"` } -// NetworkProfile - Defines the resource properties. +// NetworkProfile - Specifies the network interfaces of the virtual machine. type NetworkProfile struct { // Gets or sets the list of network interfaces associated with the virtual machine. NetworkInterfaces []*NetworkInterface `json:"networkInterfaces,omitempty"` } -// NetworkProfileUpdate - Defines the update resource properties. +// NetworkProfileUpdate - Specifies the network interfaces of the virtual machine. type NetworkProfileUpdate struct { // Gets or sets the list of network interfaces associated with the virtual machine. NetworkInterfaces []*NetworkInterfaceUpdate `json:"networkInterfaces,omitempty"` @@ -1160,7 +1169,7 @@ type OperationsList struct { NextLink *string `json:"nextLink,omitempty"` } -// OsProfile - Defines the resource properties. +// OsProfile - Specifies the operating system settings for the virtual machine. type OsProfile struct { // Gets or sets administrator password. AdminPassword *string `json:"adminPassword,omitempty"` @@ -1205,7 +1214,7 @@ type OsProfileLinuxConfiguration struct { PatchSettings *PatchSettings `json:"patchSettings,omitempty"` } -// OsProfileUpdate - Defines the os update properties. +// OsProfileUpdate - Specifies the operating system settings for the virtual machine. type OsProfileUpdate struct { // Specifies the linux configuration for update management. LinuxConfiguration *OsProfileUpdateLinuxConfiguration `json:"linuxConfiguration,omitempty"` @@ -1241,7 +1250,7 @@ type PatchSettings struct { PatchMode *string `json:"patchMode,omitempty"` } -// PlacementProfile - Defines the resource properties. +// PlacementProfile - Specifies the compute and storage placement settings for the virtual machine. type PlacementProfile struct { // Gets or sets the ARM Id of the cluster resource on which this virtual machine will deploy. ClusterID *string `json:"clusterId,omitempty"` @@ -1256,31 +1265,6 @@ type PlacementProfile struct { ResourcePoolID *string `json:"resourcePoolId,omitempty"` } -// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a -// location -type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - // ResourcePatch - Object containing updates for patch operations. type ResourcePatch struct { // Resource tags. @@ -1351,7 +1335,7 @@ func (r *ResourcePoolInventoryItem) GetInventoryItemProperties() *InventoryItemP } } -// ResourcePoolProperties - Defines the resource properties. +// ResourcePoolProperties - Describes the properties of a Resource Pool. type ResourcePoolProperties struct { // Gets or sets the inventory Item ID for the resource pool. InventoryItemID *string `json:"inventoryItemId,omitempty"` @@ -1376,6 +1360,9 @@ type ResourcePoolProperties struct { // READ-ONLY; Gets the name of the corresponding resource in Kubernetes. CustomResourceName *string `json:"customResourceName,omitempty" azure:"ro"` + // READ-ONLY; Gets or sets the datastore ARM ids. + DatastoreIDs []*string `json:"datastoreIds,omitempty" azure:"ro"` + // READ-ONLY; Gets or sets MemLimitMB specifies a memory usage limit in megabytes. Utilization will not exceed the specified // limit even if there are available resources. MemLimitMB *int64 `json:"memLimitMB,omitempty" azure:"ro"` @@ -1390,6 +1377,9 @@ type ResourcePoolProperties struct { // READ-ONLY; Gets or sets the vCenter Managed Object name for the resource pool. MoName *string `json:"moName,omitempty" azure:"ro"` + // READ-ONLY; Gets or sets the network ARM ids. + NetworkIDs []*string `json:"networkIds,omitempty" azure:"ro"` + // READ-ONLY; Gets or sets the provisioning state. ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` @@ -1478,7 +1468,7 @@ type StopVirtualMachineOptions struct { SkipShutdown *bool `json:"skipShutdown,omitempty"` } -// StorageProfile - Defines the resource properties. +// StorageProfile - Specifies the storage settings for the virtual machine disks. type StorageProfile struct { // Gets or sets the list of virtual disks associated with the virtual machine. Disks []*VirtualDisk `json:"disks,omitempty"` @@ -1487,7 +1477,7 @@ type StorageProfile struct { ScsiControllers []*VirtualSCSIController `json:"scsiControllers,omitempty" azure:"ro"` } -// StorageProfileUpdate - Defines the resource update properties. +// StorageProfileUpdate - Specifies the storage settings for the virtual machine disks. type StorageProfileUpdate struct { // Gets or sets the list of virtual disks associated with the virtual machine. Disks []*VirtualDiskUpdate `json:"disks,omitempty"` @@ -1552,7 +1542,7 @@ type VCenter struct { Type *string `json:"type,omitempty" azure:"ro"` } -// VCenterProperties - Defines the resource properties. +// VCenterProperties - Describes the properties of a VCenter. type VCenterProperties struct { // REQUIRED; Gets or sets the FQDN/IPAddress of the vCenter. Fqdn *string `json:"fqdn,omitempty"` @@ -1839,6 +1829,9 @@ type VirtualMachineInventoryItem struct { // REQUIRED; They inventory type. InventoryType *InventoryType `json:"inventoryType,omitempty"` + // Cluster inventory resource details. + Cluster *InventoryItemDetails `json:"cluster,omitempty"` + // Gets or sets the folder path of the vm. FolderPath *string `json:"folderPath,omitempty"` @@ -1899,7 +1892,7 @@ func (v *VirtualMachineInventoryItem) GetInventoryItemProperties() *InventoryIte } } -// VirtualMachineProperties - Defines the resource properties. +// VirtualMachineProperties - Describes the properties of a Virtual Machine. type VirtualMachineProperties struct { // Firmware type FirmwareType *FirmwareType `json:"firmwareType,omitempty"` @@ -2037,6 +2030,12 @@ type VirtualMachineTemplateInventoryItem struct { // READ-ONLY; Gets or sets the provisioning state. ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Gets or sets the current version of VMware Tools. + ToolsVersion *string `json:"toolsVersion,omitempty" azure:"ro"` + + // READ-ONLY; Gets or sets the current version status of VMware Tools installed in the guest operating system. + ToolsVersionStatus *string `json:"toolsVersionStatus,omitempty" azure:"ro"` } // GetInventoryItemProperties implements the InventoryItemPropertiesClassification interface for type VirtualMachineTemplateInventoryItem. @@ -2050,7 +2049,7 @@ func (v *VirtualMachineTemplateInventoryItem) GetInventoryItemProperties() *Inve } } -// VirtualMachineTemplateProperties - Defines the resource properties. +// VirtualMachineTemplateProperties - Describes the properties of a Virtual Machine Template. type VirtualMachineTemplateProperties struct { // Gets or sets the inventory Item ID for the virtual machine template. InventoryItemID *string `json:"inventoryItemId,omitempty"` @@ -2169,18 +2168,21 @@ type VirtualMachineUpdate struct { Tags map[string]*string `json:"tags,omitempty"` } -// VirtualMachineUpdateProperties - Defines the resource properties. +// VirtualMachineUpdateProperties - Describes the properties of a Virtual Machine. type VirtualMachineUpdateProperties struct { - // Defines the resource properties. + // Specifies the guest agent settings for the virtual machine. + GuestAgentProfile *GuestAgentProfileUpdate `json:"guestAgentProfile,omitempty"` + + // Specifies the hardware settings for the virtual machine. HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` - // Defines the update resource properties. + // Specifies the network interfaces of the virtual machine. NetworkProfile *NetworkProfileUpdate `json:"networkProfile,omitempty"` // OS properties. OSProfile *OsProfileUpdate `json:"osProfile,omitempty"` - // Defines the resource update properties. + // Specifies the storage settings for the virtual machine disks. StorageProfile *StorageProfileUpdate `json:"storageProfile,omitempty"` } @@ -2191,8 +2193,9 @@ type VirtualMachinesClientBeginAssessPatchesOptions struct { ResumeToken string } -// VirtualMachinesClientBeginCreateOptions contains the optional parameters for the VirtualMachinesClient.BeginCreate method. -type VirtualMachinesClientBeginCreateOptions struct { +// VirtualMachinesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachinesClient.BeginCreateOrUpdate +// method. +type VirtualMachinesClientBeginCreateOrUpdateOptions struct { // Resumes the LRO from the provided token. ResumeToken string } @@ -2245,9 +2248,8 @@ type VirtualMachinesClientGetOptions struct { // placeholder for future optional parameters } -// VirtualMachinesClientListByResourceGroupOptions contains the optional parameters for the VirtualMachinesClient.ListByResourceGroup -// method. -type VirtualMachinesClientListByResourceGroupOptions struct { +// VirtualMachinesClientListAllOptions contains the optional parameters for the VirtualMachinesClient.ListAll method. +type VirtualMachinesClientListAllOptions struct { // placeholder for future optional parameters } @@ -2326,7 +2328,7 @@ func (v *VirtualNetworkInventoryItem) GetInventoryItemProperties() *InventoryIte } } -// VirtualNetworkProperties - Defines the resource properties. +// VirtualNetworkProperties - Describes the properties of a Virtual Network. type VirtualNetworkProperties struct { // Gets or sets the inventory Item ID for the virtual network. InventoryItemID *string `json:"inventoryItemId,omitempty"` diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/models_serde.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/models_serde.go index d13c7fcca55d..14da69e34cfe 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/models_serde.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/models_serde.go @@ -279,45 +279,6 @@ func (c *ClustersList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Condition. -func (c Condition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "message", c.Message) - populate(objectMap, "reason", c.Reason) - populate(objectMap, "severity", c.Severity) - populate(objectMap, "status", c.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Condition. -func (c *Condition) 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 "message": - err = unpopulate(val, "Message", &c.Message) - delete(rawMsg, key) - case "reason": - err = unpopulate(val, "Reason", &c.Reason) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &c.Severity) - 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 Datastore. func (d Datastore) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -431,7 +392,9 @@ func (d *DatastoreInventoryItem) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DatastoreProperties. func (d DatastoreProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "capacityGB", d.CapacityGB) populate(objectMap, "customResourceName", d.CustomResourceName) + populate(objectMap, "freeSpaceGB", d.FreeSpaceGB) populate(objectMap, "inventoryItemId", d.InventoryItemID) populate(objectMap, "moName", d.MoName) populate(objectMap, "moRefId", d.MoRefID) @@ -451,9 +414,15 @@ func (d *DatastoreProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "capacityGB": + err = unpopulate(val, "CapacityGB", &d.CapacityGB) + delete(rawMsg, key) case "customResourceName": err = unpopulate(val, "CustomResourceName", &d.CustomResourceName) delete(rawMsg, key) + case "freeSpaceGB": + err = unpopulate(val, "FreeSpaceGB", &d.FreeSpaceGB) + delete(rawMsg, key) case "inventoryItemId": err = unpopulate(val, "InventoryItemID", &d.InventoryItemID) delete(rawMsg, key) @@ -514,17 +483,16 @@ func (d *DatastoresList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. -func (e ErrorDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDefinition. -func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { +// 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) @@ -532,14 +500,11 @@ func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) + case "info": + err = unpopulate(val, "Info", &e.Info) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { @@ -552,6 +517,7 @@ func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorDetail. func (e ErrorDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) populate(objectMap, "details", e.Details) populate(objectMap, "message", e.Message) @@ -568,6 +534,9 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { 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) @@ -588,15 +557,16 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. +func (e ExtendedLocation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "error", e.Error) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. +func (e *ExtendedLocation) 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) @@ -604,8 +574,11 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { @@ -615,16 +588,15 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. -func (e ExtendedLocation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionTargetProperties. +func (e ExtensionTargetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "name", e.Name) - populate(objectMap, "type", e.Type) + populate(objectMap, "targetVersion", e.TargetVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. -func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionTargetProperties. +func (e *ExtensionTargetProperties) 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) @@ -632,11 +604,8 @@ func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "targetVersion": + err = unpopulate(val, "TargetVersion", &e.TargetVersion) delete(rawMsg, key) } if err != nil { @@ -724,8 +693,10 @@ func (g *GuestAgentList) UnmarshalJSON(data []byte) error { func (g GuestAgentProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "agentVersion", g.AgentVersion) + populate(objectMap, "clientPublicKey", g.ClientPublicKey) populate(objectMap, "errorDetails", g.ErrorDetails) populateTimeRFC3339(objectMap, "lastStatusChange", g.LastStatusChange) + populate(objectMap, "mssqlDiscovered", g.MssqlDiscovered) populate(objectMap, "status", g.Status) populate(objectMap, "vmUuid", g.VMUUID) return json.Marshal(objectMap) @@ -743,12 +714,18 @@ func (g *GuestAgentProfile) UnmarshalJSON(data []byte) error { case "agentVersion": err = unpopulate(val, "AgentVersion", &g.AgentVersion) delete(rawMsg, key) + case "clientPublicKey": + err = unpopulate(val, "ClientPublicKey", &g.ClientPublicKey) + delete(rawMsg, key) case "errorDetails": err = unpopulate(val, "ErrorDetails", &g.ErrorDetails) delete(rawMsg, key) case "lastStatusChange": err = unpopulateTimeRFC3339(val, "LastStatusChange", &g.LastStatusChange) delete(rawMsg, key) + case "mssqlDiscovered": + err = unpopulate(val, "MssqlDiscovered", &g.MssqlDiscovered) + delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &g.Status) delete(rawMsg, key) @@ -763,6 +740,33 @@ func (g *GuestAgentProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type GuestAgentProfileUpdate. +func (g GuestAgentProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientPublicKey", g.ClientPublicKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentProfileUpdate. +func (g *GuestAgentProfileUpdate) 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 "clientPublicKey": + err = unpopulate(val, "ClientPublicKey", &g.ClientPublicKey) + 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 GuestAgentProperties. func (g GuestAgentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1033,9 +1037,11 @@ func (h *HostInventoryItem) UnmarshalJSON(data []byte) error { func (h HostProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "customResourceName", h.CustomResourceName) + populate(objectMap, "datastoreIds", h.DatastoreIDs) populate(objectMap, "inventoryItemId", h.InventoryItemID) populate(objectMap, "moName", h.MoName) populate(objectMap, "moRefId", h.MoRefID) + populate(objectMap, "networkIds", h.NetworkIDs) populate(objectMap, "provisioningState", h.ProvisioningState) populate(objectMap, "statuses", h.Statuses) populate(objectMap, "uuid", h.UUID) @@ -1055,6 +1061,9 @@ func (h *HostProperties) UnmarshalJSON(data []byte) error { case "customResourceName": err = unpopulate(val, "CustomResourceName", &h.CustomResourceName) delete(rawMsg, key) + case "datastoreIds": + err = unpopulate(val, "DatastoreIDs", &h.DatastoreIDs) + delete(rawMsg, key) case "inventoryItemId": err = unpopulate(val, "InventoryItemID", &h.InventoryItemID) delete(rawMsg, key) @@ -1064,6 +1073,9 @@ func (h *HostProperties) UnmarshalJSON(data []byte) error { case "moRefId": err = unpopulate(val, "MoRefID", &h.MoRefID) delete(rawMsg, key) + case "networkIds": + err = unpopulate(val, "NetworkIDs", &h.NetworkIDs) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) delete(rawMsg, key) @@ -1314,6 +1326,7 @@ func (i *InventoryItem) UnmarshalJSON(data []byte) error { func (i InventoryItemDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "inventoryItemId", i.InventoryItemID) + populate(objectMap, "inventoryType", i.InventoryType) populate(objectMap, "moName", i.MoName) return json.Marshal(objectMap) } @@ -1330,6 +1343,9 @@ func (i *InventoryItemDetails) UnmarshalJSON(data []byte) error { case "inventoryItemId": err = unpopulate(val, "InventoryItemID", &i.InventoryItemID) delete(rawMsg, key) + case "inventoryType": + err = unpopulate(val, "InventoryType", &i.InventoryType) + delete(rawMsg, key) case "moName": err = unpopulate(val, "MoName", &i.MoName) delete(rawMsg, key) @@ -1501,45 +1517,6 @@ func (m *MachineExtension) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MachineExtensionInstanceView. -func (m MachineExtensionInstanceView) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", m.Name) - populate(objectMap, "status", m.Status) - populate(objectMap, "type", m.Type) - populate(objectMap, "typeHandlerVersion", m.TypeHandlerVersion) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionInstanceView. -func (m *MachineExtensionInstanceView) 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 "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - case "typeHandlerVersion": - err = unpopulate(val, "TypeHandlerVersion", &m.TypeHandlerVersion) - 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 MachineExtensionInstanceViewStatus. func (m MachineExtensionInstanceViewStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1771,6 +1748,33 @@ func (m *MachineExtensionUpdateProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MachineExtensionUpgrade. +func (m MachineExtensionUpgrade) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extensionTargets", m.ExtensionTargets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionUpgrade. +func (m *MachineExtensionUpgrade) 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 "extensionTargets": + err = unpopulate(val, "ExtensionTargets", &m.ExtensionTargets) + 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 MachineExtensionsListResult. func (m MachineExtensionsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -2441,76 +2445,6 @@ func (p *PlacementProfile) UnmarshalJSON(data []byte) error { 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 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 ResourcePatch. func (r ResourcePatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -2651,12 +2585,14 @@ func (r ResourcePoolProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "cpuReservationMHz", r.CPUReservationMHz) populate(objectMap, "cpuSharesLevel", r.CPUSharesLevel) populate(objectMap, "customResourceName", r.CustomResourceName) + populate(objectMap, "datastoreIds", r.DatastoreIDs) populate(objectMap, "inventoryItemId", r.InventoryItemID) populate(objectMap, "memLimitMB", r.MemLimitMB) populate(objectMap, "memReservationMB", r.MemReservationMB) populate(objectMap, "memSharesLevel", r.MemSharesLevel) populate(objectMap, "moName", r.MoName) populate(objectMap, "moRefId", r.MoRefID) + populate(objectMap, "networkIds", r.NetworkIDs) populate(objectMap, "provisioningState", r.ProvisioningState) populate(objectMap, "statuses", r.Statuses) populate(objectMap, "uuid", r.UUID) @@ -2685,6 +2621,9 @@ func (r *ResourcePoolProperties) UnmarshalJSON(data []byte) error { case "customResourceName": err = unpopulate(val, "CustomResourceName", &r.CustomResourceName) delete(rawMsg, key) + case "datastoreIds": + err = unpopulate(val, "DatastoreIDs", &r.DatastoreIDs) + delete(rawMsg, key) case "inventoryItemId": err = unpopulate(val, "InventoryItemID", &r.InventoryItemID) delete(rawMsg, key) @@ -2703,6 +2642,9 @@ func (r *ResourcePoolProperties) UnmarshalJSON(data []byte) error { case "moRefId": err = unpopulate(val, "MoRefID", &r.MoRefID) delete(rawMsg, key) + case "networkIds": + err = unpopulate(val, "NetworkIDs", &r.NetworkIDs) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) delete(rawMsg, key) @@ -3540,6 +3482,7 @@ func (v *VirtualMachineInstallPatchesResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VirtualMachineInventoryItem. func (v VirtualMachineInventoryItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "cluster", v.Cluster) populate(objectMap, "folderPath", v.FolderPath) populate(objectMap, "host", v.Host) populate(objectMap, "ipAddresses", v.IPAddresses) @@ -3569,6 +3512,9 @@ func (v *VirtualMachineInventoryItem) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "cluster": + err = unpopulate(val, "Cluster", &v.Cluster) + delete(rawMsg, key) case "folderPath": err = unpopulate(val, "FolderPath", &v.FolderPath) delete(rawMsg, key) @@ -3816,6 +3762,8 @@ func (v VirtualMachineTemplateInventoryItem) MarshalJSON() ([]byte, error) { populate(objectMap, "osName", v.OSName) populate(objectMap, "osType", v.OSType) populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "toolsVersion", v.ToolsVersion) + populate(objectMap, "toolsVersionStatus", v.ToolsVersionStatus) return json.Marshal(objectMap) } @@ -3861,6 +3809,12 @@ func (v *VirtualMachineTemplateInventoryItem) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) delete(rawMsg, key) + case "toolsVersion": + err = unpopulate(val, "ToolsVersion", &v.ToolsVersion) + delete(rawMsg, key) + case "toolsVersionStatus": + err = unpopulate(val, "ToolsVersionStatus", &v.ToolsVersionStatus) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -4037,6 +3991,7 @@ func (v *VirtualMachineUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VirtualMachineUpdateProperties. func (v VirtualMachineUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "guestAgentProfile", v.GuestAgentProfile) populate(objectMap, "hardwareProfile", v.HardwareProfile) populate(objectMap, "networkProfile", v.NetworkProfile) populate(objectMap, "osProfile", v.OSProfile) @@ -4053,6 +4008,9 @@ func (v *VirtualMachineUpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "guestAgentProfile": + err = unpopulate(val, "GuestAgentProfile", &v.GuestAgentProfile) + delete(rawMsg, key) case "hardwareProfile": err = unpopulate(val, "HardwareProfile", &v.HardwareProfile) delete(rawMsg, key) diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/operations_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/operations_client.go index 6a64f76239f6..cd0e5a2b408a 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/operations_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/operations_client.go @@ -58,8 +58,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Returns list of all operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // 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]{ @@ -97,7 +96,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/operations_client_example_test.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/operations_client_example_test.go deleted file mode 100644 index 3d2e2104ad52..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/operations_client_example_test.go +++ /dev/null @@ -1,41 +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 armconnectedvmware_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedvmware/armconnectedvmware" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListOperations.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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 - } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/resourcepools_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/resourcepools_client.go index c027d9ec21c7..1e833762c199 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/resourcepools_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/resourcepools_client.go @@ -66,7 +66,7 @@ func NewResourcePoolsClient(subscriptionID string, credential azcore.TokenCreden // BeginCreate - Create Or Update resourcePool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // resourcePoolName - Name of the resourcePool. // body - Request payload. @@ -88,7 +88,7 @@ func (client *ResourcePoolsClient) BeginCreate(ctx context.Context, resourceGrou // Create - Create Or Update resourcePool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *ResourcePoolsClient) create(ctx context.Context, resourceGroupName string, resourcePoolName string, body ResourcePool, options *ResourcePoolsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, resourcePoolName, body, options) if err != nil { @@ -124,7 +124,7 @@ func (client *ResourcePoolsClient) createCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -132,7 +132,7 @@ func (client *ResourcePoolsClient) createCreateRequest(ctx context.Context, reso // BeginDelete - Implements resourcePool DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // resourcePoolName - Name of the resourcePool. // options - ResourcePoolsClientBeginDeleteOptions contains the optional parameters for the ResourcePoolsClient.BeginDelete @@ -151,7 +151,7 @@ func (client *ResourcePoolsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Implements resourcePool DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *ResourcePoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourcePoolName string, options *ResourcePoolsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourcePoolName, options) if err != nil { @@ -187,7 +187,7 @@ func (client *ResourcePoolsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -198,7 +198,7 @@ func (client *ResourcePoolsClient) deleteCreateRequest(ctx context.Context, reso // Get - Implements resourcePool GET method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // resourcePoolName - Name of the resourcePool. // options - ResourcePoolsClientGetOptions contains the optional parameters for the ResourcePoolsClient.Get method. @@ -237,7 +237,7 @@ func (client *ResourcePoolsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,8 +253,7 @@ func (client *ResourcePoolsClient) getHandleResponse(resp *http.Response) (Resou } // NewListPager - List of resourcePools in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // options - ResourcePoolsClientListOptions contains the optional parameters for the ResourcePoolsClient.List method. func (client *ResourcePoolsClient) NewListPager(options *ResourcePoolsClientListOptions) *runtime.Pager[ResourcePoolsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ResourcePoolsClientListResponse]{ @@ -296,7 +295,7 @@ func (client *ResourcePoolsClient) listCreateRequest(ctx context.Context, option return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -312,8 +311,7 @@ func (client *ResourcePoolsClient) listHandleResponse(resp *http.Response) (Reso } // NewListByResourceGroupPager - List of resourcePools in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // options - ResourcePoolsClientListByResourceGroupOptions contains the optional parameters for the ResourcePoolsClient.ListByResourceGroup // method. @@ -361,7 +359,7 @@ func (client *ResourcePoolsClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -378,7 +376,7 @@ func (client *ResourcePoolsClient) listByResourceGroupHandleResponse(resp *http. // Update - API to update certain properties of the resourcePool resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // resourcePoolName - Name of the resourcePool. // body - Resource properties to update. @@ -418,7 +416,7 @@ func (client *ResourcePoolsClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/resourcepools_client_example_test.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/resourcepools_client_example_test.go deleted file mode 100644 index 8a73ac463f67..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/resourcepools_client_example_test.go +++ /dev/null @@ -1,163 +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 armconnectedvmware_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/connectedvmware/armconnectedvmware" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/CreateResourcePool.json -func ExampleResourcePoolsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewResourcePoolsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "testrg", "HRPool", armconnectedvmware.ResourcePool{ - ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - Type: to.Ptr("customLocation"), - }, - Location: to.Ptr("East US"), - Properties: &armconnectedvmware.ResourcePoolProperties{ - MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/GetResourcePool.json -func ExampleResourcePoolsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewResourcePoolsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "HRPool", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/UpdateResourcePool.json -func ExampleResourcePoolsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewResourcePoolsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "testrg", "HRPool", armconnectedvmware.ResourcePatch{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/DeleteResourcePool.json -func ExampleResourcePoolsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewResourcePoolsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "HRPool", &armconnectedvmware.ResourcePoolsClientBeginDeleteOptions{Force: 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListResourcePools.json -func ExampleResourcePoolsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewResourcePoolsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListResourcePoolsByResourceGroup.json -func ExampleResourcePoolsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewResourcePoolsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", 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 - } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/response_types.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/response_types.go index fc236dd6d256..6c00b99aaf55 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/response_types.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/response_types.go @@ -17,6 +17,11 @@ package armconnectedvmware +// AzureArcVMwareManagementServiceAPIClientUpgradeExtensionsResponse contains the response from method AzureArcVMwareManagementServiceAPIClient.UpgradeExtensions. +type AzureArcVMwareManagementServiceAPIClientUpgradeExtensionsResponse struct { + // placeholder for future response values +} + // ClustersClientCreateResponse contains the response from method ClustersClient.Create. type ClustersClientCreateResponse struct { Cluster @@ -92,8 +97,8 @@ type GuestAgentsClientGetResponse struct { GuestAgent } -// GuestAgentsClientListByVMResponse contains the response from method GuestAgentsClient.ListByVM. -type GuestAgentsClientListByVMResponse struct { +// GuestAgentsClientListResponse contains the response from method GuestAgentsClient.List. +type GuestAgentsClientListResponse struct { GuestAgentList } @@ -142,8 +147,8 @@ type HybridIdentityMetadataClientGetResponse struct { HybridIdentityMetadata } -// HybridIdentityMetadataClientListByVMResponse contains the response from method HybridIdentityMetadataClient.ListByVM. -type HybridIdentityMetadataClientListByVMResponse struct { +// HybridIdentityMetadataClientListResponse contains the response from method HybridIdentityMetadataClient.List. +type HybridIdentityMetadataClientListResponse struct { HybridIdentityMetadataList } @@ -292,8 +297,8 @@ type VirtualMachinesClientAssessPatchesResponse struct { VirtualMachineAssessPatchesResult } -// VirtualMachinesClientCreateResponse contains the response from method VirtualMachinesClient.Create. -type VirtualMachinesClientCreateResponse struct { +// VirtualMachinesClientCreateOrUpdateResponse contains the response from method VirtualMachinesClient.CreateOrUpdate. +type VirtualMachinesClientCreateOrUpdateResponse struct { VirtualMachine } @@ -312,8 +317,8 @@ type VirtualMachinesClientInstallPatchesResponse struct { VirtualMachineInstallPatchesResult } -// VirtualMachinesClientListByResourceGroupResponse contains the response from method VirtualMachinesClient.ListByResourceGroup. -type VirtualMachinesClientListByResourceGroupResponse struct { +// VirtualMachinesClientListAllResponse contains the response from method VirtualMachinesClient.ListAll. +type VirtualMachinesClientListAllResponse struct { VirtualMachinesList } diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/vcenters_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/vcenters_client.go index bcc7f181bace..8c1b4ec183a5 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/vcenters_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/vcenters_client.go @@ -66,7 +66,7 @@ func NewVCentersClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Create Or Update vCenter. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // vcenterName - Name of the vCenter. // body - Request payload. @@ -87,7 +87,7 @@ func (client *VCentersClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Create Or Update vCenter. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *VCentersClient) create(ctx context.Context, resourceGroupName string, vcenterName string, body VCenter, options *VCentersClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, vcenterName, body, options) if err != nil { @@ -123,7 +123,7 @@ func (client *VCentersClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -131,7 +131,7 @@ func (client *VCentersClient) createCreateRequest(ctx context.Context, resourceG // BeginDelete - Implements vCenter DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // vcenterName - Name of the vCenter. // options - VCentersClientBeginDeleteOptions contains the optional parameters for the VCentersClient.BeginDelete method. @@ -149,7 +149,7 @@ func (client *VCentersClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Implements vCenter DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *VCentersClient) deleteOperation(ctx context.Context, resourceGroupName string, vcenterName string, options *VCentersClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vcenterName, options) if err != nil { @@ -185,7 +185,7 @@ func (client *VCentersClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -196,7 +196,7 @@ func (client *VCentersClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Implements vCenter GET method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // vcenterName - Name of the vCenter. // options - VCentersClientGetOptions contains the optional parameters for the VCentersClient.Get method. @@ -235,7 +235,7 @@ func (client *VCentersClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,8 +251,7 @@ func (client *VCentersClient) getHandleResponse(resp *http.Response) (VCentersCl } // NewListPager - List of vCenters in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // options - VCentersClientListOptions contains the optional parameters for the VCentersClient.List method. func (client *VCentersClient) NewListPager(options *VCentersClientListOptions) *runtime.Pager[VCentersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[VCentersClientListResponse]{ @@ -294,7 +293,7 @@ func (client *VCentersClient) listCreateRequest(ctx context.Context, options *VC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -310,8 +309,7 @@ func (client *VCentersClient) listHandleResponse(resp *http.Response) (VCentersC } // NewListByResourceGroupPager - List of vCenters in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // options - VCentersClientListByResourceGroupOptions contains the optional parameters for the VCentersClient.ListByResourceGroup // method. @@ -359,7 +357,7 @@ func (client *VCentersClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -376,7 +374,7 @@ func (client *VCentersClient) listByResourceGroupHandleResponse(resp *http.Respo // Update - API to update certain properties of the vCenter resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // vcenterName - Name of the vCenter. // body - Resource properties to update. @@ -416,7 +414,7 @@ func (client *VCentersClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/vcenters_client_example_test.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/vcenters_client_example_test.go deleted file mode 100644 index 73648ad86358..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/vcenters_client_example_test.go +++ /dev/null @@ -1,167 +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 armconnectedvmware_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/connectedvmware/armconnectedvmware" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/CreateVCenter.json -func ExampleVCentersClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVCentersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "testrg", "ContosoVCenter", armconnectedvmware.VCenter{ - ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - Type: to.Ptr("customLocation"), - }, - Location: to.Ptr("East US"), - Properties: &armconnectedvmware.VCenterProperties{ - Credentials: &armconnectedvmware.VICredential{ - Password: to.Ptr(""), - Username: to.Ptr("tempuser"), - }, - Fqdn: to.Ptr("ContosoVMware.contoso.com"), - Port: to.Ptr[int32](1234), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/GetVCenter.json -func ExampleVCentersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVCentersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "ContosoVCenter", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/UpdateVCenter.json -func ExampleVCentersClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVCentersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "testrg", "ContosoVCenter", armconnectedvmware.ResourcePatch{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/DeleteVCenter.json -func ExampleVCentersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVCentersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "ContosoVCenter", &armconnectedvmware.VCentersClientBeginDeleteOptions{Force: 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListVCenters.json -func ExampleVCentersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVCentersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListVCentersByResourceGroup.json -func ExampleVCentersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVCentersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", 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 - } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachines_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachines_client.go index e91233a3d629..2bf3cfca5de9 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachines_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachines_client.go @@ -66,14 +66,14 @@ func NewVirtualMachinesClient(subscriptionID string, credential azcore.TokenCred // BeginAssessPatches - The operation to assess patches on a vSphere VMware machine identity in Azure. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The name of the resource group. -// name - The name of the vSphere VMware machine. +// virtualMachineName - The name of the vSphere VMware machine. // options - VirtualMachinesClientBeginAssessPatchesOptions contains the optional parameters for the VirtualMachinesClient.BeginAssessPatches // method. -func (client *VirtualMachinesClient) BeginAssessPatches(ctx context.Context, resourceGroupName string, name string, options *VirtualMachinesClientBeginAssessPatchesOptions) (*runtime.Poller[VirtualMachinesClientAssessPatchesResponse], error) { +func (client *VirtualMachinesClient) BeginAssessPatches(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginAssessPatchesOptions) (*runtime.Poller[VirtualMachinesClientAssessPatchesResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.assessPatches(ctx, resourceGroupName, name, options) + resp, err := client.assessPatches(ctx, resourceGroupName, virtualMachineName, options) if err != nil { return nil, err } @@ -87,9 +87,9 @@ func (client *VirtualMachinesClient) BeginAssessPatches(ctx context.Context, res // AssessPatches - The operation to assess patches on a vSphere VMware machine identity in Azure. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview -func (client *VirtualMachinesClient) assessPatches(ctx context.Context, resourceGroupName string, name string, options *VirtualMachinesClientBeginAssessPatchesOptions) (*http.Response, error) { - req, err := client.assessPatchesCreateRequest(ctx, resourceGroupName, name, options) +// Generated from API version 2022-07-15-preview +func (client *VirtualMachinesClient) assessPatches(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginAssessPatchesOptions) (*http.Response, error) { + req, err := client.assessPatchesCreateRequest(ctx, resourceGroupName, virtualMachineName, options) if err != nil { return nil, err } @@ -104,8 +104,8 @@ func (client *VirtualMachinesClient) assessPatches(ctx context.Context, resource } // assessPatchesCreateRequest creates the AssessPatches request. -func (client *VirtualMachinesClient) assessPatchesCreateRequest(ctx context.Context, resourceGroupName string, name string, options *VirtualMachinesClientBeginAssessPatchesOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/assessPatches" +func (client *VirtualMachinesClient) assessPatchesCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginAssessPatchesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/assessPatches" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -114,48 +114,48 @@ func (client *VirtualMachinesClient) assessPatchesCreateRequest(ctx context.Cont return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") + if virtualMachineName == "" { + return nil, errors.New("parameter virtualMachineName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineName}", url.PathEscape(virtualMachineName)) 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-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// BeginCreate - Create Or Update virtual machine. +// BeginCreateOrUpdate - Create Or Update virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the virtual machine resource. // body - Request payload. -// options - VirtualMachinesClientBeginCreateOptions contains the optional parameters for the VirtualMachinesClient.BeginCreate +// options - VirtualMachinesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachinesClient.BeginCreateOrUpdate // method. -func (client *VirtualMachinesClient) BeginCreate(ctx context.Context, resourceGroupName string, virtualMachineName string, body VirtualMachine, options *VirtualMachinesClientBeginCreateOptions) (*runtime.Poller[VirtualMachinesClientCreateResponse], error) { +func (client *VirtualMachinesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, body VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachinesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, virtualMachineName, body, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualMachineName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientCreateResponse]{ + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[VirtualMachinesClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[VirtualMachinesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } } -// Create - Create Or Update virtual machine. +// CreateOrUpdate - Create Or Update virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview -func (client *VirtualMachinesClient) create(ctx context.Context, resourceGroupName string, virtualMachineName string, body VirtualMachine, options *VirtualMachinesClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, resourceGroupName, virtualMachineName, body, options) +// Generated from API version 2022-07-15-preview +func (client *VirtualMachinesClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, body VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualMachineName, body, options) if err != nil { return nil, err } @@ -169,8 +169,8 @@ func (client *VirtualMachinesClient) create(ctx context.Context, resourceGroupNa return resp, nil } -// createCreateRequest creates the Create request. -func (client *VirtualMachinesClient) createCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, body VirtualMachine, options *VirtualMachinesClientBeginCreateOptions) (*policy.Request, error) { +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, body VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -189,7 +189,7 @@ func (client *VirtualMachinesClient) createCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -197,7 +197,7 @@ func (client *VirtualMachinesClient) createCreateRequest(ctx context.Context, re // BeginDelete - Implements virtual machine DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the virtual machine resource. // options - VirtualMachinesClientBeginDeleteOptions contains the optional parameters for the VirtualMachinesClient.BeginDelete @@ -216,7 +216,7 @@ func (client *VirtualMachinesClient) BeginDelete(ctx context.Context, resourceGr // Delete - Implements virtual machine DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *VirtualMachinesClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualMachineName, options) if err != nil { @@ -252,13 +252,13 @@ func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - if options != nil && options.Force != nil { - reqQP.Set("force", strconv.FormatBool(*options.Force)) - } + reqQP.Set("api-version", "2022-07-15-preview") if options != nil && options.Retain != nil { reqQP.Set("retain", strconv.FormatBool(*options.Retain)) } + if options != nil && options.Force != nil { + reqQP.Set("force", strconv.FormatBool(*options.Force)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +266,7 @@ func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, re // Get - Implements virtual machine GET method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the virtual machine resource. // options - VirtualMachinesClientGetOptions contains the optional parameters for the VirtualMachinesClient.Get method. @@ -305,7 +305,7 @@ func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,15 +322,15 @@ func (client *VirtualMachinesClient) getHandleResponse(resp *http.Response) (Vir // BeginInstallPatches - The operation to install patches on a vSphere VMware machine identity in Azure. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The name of the resource group. -// name - The name of the vSphere VMware machine. +// virtualMachineName - The name of the vSphere VMware machine. // installPatchesInput - Input for InstallPatches as directly received by the API // options - VirtualMachinesClientBeginInstallPatchesOptions contains the optional parameters for the VirtualMachinesClient.BeginInstallPatches // method. -func (client *VirtualMachinesClient) BeginInstallPatches(ctx context.Context, resourceGroupName string, name string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesClientBeginInstallPatchesOptions) (*runtime.Poller[VirtualMachinesClientInstallPatchesResponse], error) { +func (client *VirtualMachinesClient) BeginInstallPatches(ctx context.Context, resourceGroupName string, virtualMachineName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesClientBeginInstallPatchesOptions) (*runtime.Poller[VirtualMachinesClientInstallPatchesResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.installPatches(ctx, resourceGroupName, name, installPatchesInput, options) + resp, err := client.installPatches(ctx, resourceGroupName, virtualMachineName, installPatchesInput, options) if err != nil { return nil, err } @@ -344,9 +344,9 @@ func (client *VirtualMachinesClient) BeginInstallPatches(ctx context.Context, re // InstallPatches - The operation to install patches on a vSphere VMware machine identity in Azure. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview -func (client *VirtualMachinesClient) installPatches(ctx context.Context, resourceGroupName string, name string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesClientBeginInstallPatchesOptions) (*http.Response, error) { - req, err := client.installPatchesCreateRequest(ctx, resourceGroupName, name, installPatchesInput, options) +// Generated from API version 2022-07-15-preview +func (client *VirtualMachinesClient) installPatches(ctx context.Context, resourceGroupName string, virtualMachineName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesClientBeginInstallPatchesOptions) (*http.Response, error) { + req, err := client.installPatchesCreateRequest(ctx, resourceGroupName, virtualMachineName, installPatchesInput, options) if err != nil { return nil, err } @@ -361,8 +361,8 @@ func (client *VirtualMachinesClient) installPatches(ctx context.Context, resourc } // installPatchesCreateRequest creates the InstallPatches request. -func (client *VirtualMachinesClient) installPatchesCreateRequest(ctx context.Context, resourceGroupName string, name string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesClientBeginInstallPatchesOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/installPatches" +func (client *VirtualMachinesClient) installPatchesCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesClientBeginInstallPatchesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/installPatches" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -371,26 +371,26 @@ func (client *VirtualMachinesClient) installPatchesCreateRequest(ctx context.Con return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") + if virtualMachineName == "" { + return nil, errors.New("parameter virtualMachineName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineName}", url.PathEscape(virtualMachineName)) 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-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, installPatchesInput) } -// NewListPager - List of virtualMachines in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// NewListPager - List of virtualMachines in a resource group. +// Generated from API version 2022-07-15-preview +// resourceGroupName - The Resource Group Name. // options - VirtualMachinesClientListOptions contains the optional parameters for the VirtualMachinesClient.List method. -func (client *VirtualMachinesClient) NewListPager(options *VirtualMachinesClientListOptions) *runtime.Pager[VirtualMachinesClientListResponse] { +func (client *VirtualMachinesClient) NewListPager(resourceGroupName string, options *VirtualMachinesClientListOptions) *runtime.Pager[VirtualMachinesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[VirtualMachinesClientListResponse]{ More: func(page VirtualMachinesClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -399,7 +399,7 @@ func (client *VirtualMachinesClient) NewListPager(options *VirtualMachinesClient var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } @@ -419,18 +419,22 @@ func (client *VirtualMachinesClient) NewListPager(options *VirtualMachinesClient } // listCreateRequest creates the List request. -func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, options *VirtualMachinesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines" +func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualMachinesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -445,74 +449,67 @@ func (client *VirtualMachinesClient) listHandleResponse(resp *http.Response) (Vi return result, nil } -// NewListByResourceGroupPager - List of virtualMachines in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview -// resourceGroupName - The Resource Group Name. -// options - VirtualMachinesClientListByResourceGroupOptions contains the optional parameters for the VirtualMachinesClient.ListByResourceGroup -// method. -func (client *VirtualMachinesClient) NewListByResourceGroupPager(resourceGroupName string, options *VirtualMachinesClientListByResourceGroupOptions) *runtime.Pager[VirtualMachinesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[VirtualMachinesClientListByResourceGroupResponse]{ - More: func(page VirtualMachinesClientListByResourceGroupResponse) bool { +// NewListAllPager - List of virtualMachines in a subscription. +// Generated from API version 2022-07-15-preview +// options - VirtualMachinesClientListAllOptions contains the optional parameters for the VirtualMachinesClient.ListAll method. +func (client *VirtualMachinesClient) NewListAllPager(options *VirtualMachinesClientListAllOptions) *runtime.Pager[VirtualMachinesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachinesClientListAllResponse]{ + More: func(page VirtualMachinesClientListAllResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *VirtualMachinesClientListByResourceGroupResponse) (VirtualMachinesClientListByResourceGroupResponse, error) { + Fetcher: func(ctx context.Context, page *VirtualMachinesClientListAllResponse) (VirtualMachinesClientListAllResponse, error) { var req *policy.Request var err error if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + req, err = client.listAllCreateRequest(ctx, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { - return VirtualMachinesClientListByResourceGroupResponse{}, err + return VirtualMachinesClientListAllResponse{}, err } resp, err := client.pl.Do(req) if err != nil { - return VirtualMachinesClientListByResourceGroupResponse{}, err + return VirtualMachinesClientListAllResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualMachinesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + return VirtualMachinesClientListAllResponse{}, runtime.NewResponseError(resp) } - return client.listByResourceGroupHandleResponse(resp) + return client.listAllHandleResponse(resp) }, }) } -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *VirtualMachinesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualMachinesClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines" +// listAllCreateRequest creates the ListAll request. +func (client *VirtualMachinesClient) listAllCreateRequest(ctx context.Context, options *VirtualMachinesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *VirtualMachinesClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualMachinesClientListByResourceGroupResponse, error) { - result := VirtualMachinesClientListByResourceGroupResponse{} +// listAllHandleResponse handles the ListAll response. +func (client *VirtualMachinesClient) listAllHandleResponse(resp *http.Response) (VirtualMachinesClientListAllResponse, error) { + result := VirtualMachinesClientListAllResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachinesList); err != nil { - return VirtualMachinesClientListByResourceGroupResponse{}, err + return VirtualMachinesClientListAllResponse{}, err } return result, nil } // BeginRestart - Restart virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the virtual machine resource. // options - VirtualMachinesClientBeginRestartOptions contains the optional parameters for the VirtualMachinesClient.BeginRestart @@ -523,7 +520,9 @@ func (client *VirtualMachinesClient) BeginRestart(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller[VirtualMachinesClientRestartResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientRestartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[VirtualMachinesClientRestartResponse](options.ResumeToken, client.pl, nil) } @@ -531,7 +530,7 @@ func (client *VirtualMachinesClient) BeginRestart(ctx context.Context, resourceG // Restart - Restart virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *VirtualMachinesClient) restart(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, virtualMachineName, options) if err != nil { @@ -567,7 +566,7 @@ func (client *VirtualMachinesClient) restartCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -575,7 +574,7 @@ func (client *VirtualMachinesClient) restartCreateRequest(ctx context.Context, r // BeginStart - Start virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the virtual machine resource. // options - VirtualMachinesClientBeginStartOptions contains the optional parameters for the VirtualMachinesClient.BeginStart @@ -586,7 +585,9 @@ func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller[VirtualMachinesClientStartResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[VirtualMachinesClientStartResponse](options.ResumeToken, client.pl, nil) } @@ -594,7 +595,7 @@ func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGro // Start - Start virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *VirtualMachinesClient) start(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, virtualMachineName, options) if err != nil { @@ -630,7 +631,7 @@ func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -638,7 +639,7 @@ func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, res // BeginStop - Stop virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the virtual machine resource. // options - VirtualMachinesClientBeginStopOptions contains the optional parameters for the VirtualMachinesClient.BeginStop @@ -649,7 +650,9 @@ func (client *VirtualMachinesClient) BeginStop(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller[VirtualMachinesClientStopResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[VirtualMachinesClientStopResponse](options.ResumeToken, client.pl, nil) } @@ -657,7 +660,7 @@ func (client *VirtualMachinesClient) BeginStop(ctx context.Context, resourceGrou // Stop - Stop virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *VirtualMachinesClient) stop(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginStopOptions) (*http.Response, error) { req, err := client.stopCreateRequest(ctx, resourceGroupName, virtualMachineName, options) if err != nil { @@ -693,7 +696,7 @@ func (client *VirtualMachinesClient) stopCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -704,7 +707,7 @@ func (client *VirtualMachinesClient) stopCreateRequest(ctx context.Context, reso // BeginUpdate - API to update certain properties of the virtual machine resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineName - Name of the virtual machine resource. // body - Resource properties to update. @@ -724,7 +727,7 @@ func (client *VirtualMachinesClient) BeginUpdate(ctx context.Context, resourceGr // Update - API to update certain properties of the virtual machine resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *VirtualMachinesClient) update(ctx context.Context, resourceGroupName string, virtualMachineName string, body VirtualMachineUpdate, options *VirtualMachinesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, virtualMachineName, body, options) if err != nil { @@ -760,7 +763,7 @@ func (client *VirtualMachinesClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachines_client_example_test.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachines_client_example_test.go deleted file mode 100644 index 24bc2a6868d0..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachines_client_example_test.go +++ /dev/null @@ -1,297 +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 armconnectedvmware_test - -import ( - "context" - "log" - - "time" - - "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/connectedvmware/armconnectedvmware" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/VirtualMachineAssessPatches.json -func ExampleVirtualMachinesClient_BeginAssessPatches() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginAssessPatches(ctx, "myResourceGroupName", "myMachineName", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/VirtualMachineInstallPatches.json -func ExampleVirtualMachinesClient_BeginInstallPatches() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginInstallPatches(ctx, "myResourceGroupName", "myMachineName", armconnectedvmware.VirtualMachineInstallPatchesParameters{ - MaximumDuration: to.Ptr("PT3H"), - RebootSetting: to.Ptr(armconnectedvmware.VMGuestPatchRebootSettingIfRequired), - WindowsParameters: &armconnectedvmware.WindowsParameters{ - ClassificationsToInclude: []*armconnectedvmware.VMGuestPatchClassificationWindows{ - to.Ptr(armconnectedvmware.VMGuestPatchClassificationWindowsCritical), - to.Ptr(armconnectedvmware.VMGuestPatchClassificationWindowsSecurity)}, - MaxPatchPublishDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-15T02:36:43.0539904+00:00"); return t }()), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/CreateVirtualMachine.json -func ExampleVirtualMachinesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachinesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "testrg", "DemoVM", armconnectedvmware.VirtualMachine{ - ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - Type: to.Ptr("customLocation"), - }, - Location: to.Ptr("East US"), - Properties: &armconnectedvmware.VirtualMachineProperties{ - HardwareProfile: &armconnectedvmware.HardwareProfile{ - MemorySizeMB: to.Ptr[int32](4196), - NumCPUs: to.Ptr[int32](4), - }, - ResourcePoolID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/ResourcePools/HRPool"), - TemplateID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualMachineTemplates/WebFrontEndTemplate"), - VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/GetVirtualMachine.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 := armconnectedvmware.NewVirtualMachinesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "DemoVM", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/UpdateVirtualMachine.json -func ExampleVirtualMachinesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachinesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "testrg", "DemoVM", armconnectedvmware.VirtualMachineUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/DeleteVirtualMachine.json -func ExampleVirtualMachinesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachinesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "DemoVM", &armconnectedvmware.VirtualMachinesClientBeginDeleteOptions{Force: nil, - Retain: 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/StopVirtualMachine.json -func ExampleVirtualMachinesClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachinesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStop(ctx, "testrg", "DemoVM", &armconnectedvmware.VirtualMachinesClientBeginStopOptions{Body: &armconnectedvmware.StopVirtualMachineOptions{ - SkipShutdown: to.Ptr(true), - }, - }) - 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/StartVirtualMachine.json -func ExampleVirtualMachinesClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachinesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, "testrg", "DemoVM", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/RestartVirtualMachine.json -func ExampleVirtualMachinesClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachinesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, "testrg", "DemoVM", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListVirtualMachines.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 := armconnectedvmware.NewVirtualMachinesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListVirtualMachinesByResourceGroup.json -func ExampleVirtualMachinesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachinesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", 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 - } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachinetemplates_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachinetemplates_client.go index 8e88177ae43b..aed152271f18 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachinetemplates_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachinetemplates_client.go @@ -66,7 +66,7 @@ func NewVirtualMachineTemplatesClient(subscriptionID string, credential azcore.T // BeginCreate - Create Or Update virtual machine template. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineTemplateName - Name of the virtual machine template resource. // body - Request payload. @@ -88,7 +88,7 @@ func (client *VirtualMachineTemplatesClient) BeginCreate(ctx context.Context, re // Create - Create Or Update virtual machine template. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *VirtualMachineTemplatesClient) create(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, body VirtualMachineTemplate, options *VirtualMachineTemplatesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, virtualMachineTemplateName, body, options) if err != nil { @@ -124,7 +124,7 @@ func (client *VirtualMachineTemplatesClient) createCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -132,7 +132,7 @@ func (client *VirtualMachineTemplatesClient) createCreateRequest(ctx context.Con // BeginDelete - Implements virtual machine template DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineTemplateName - Name of the virtual machine template resource. // options - VirtualMachineTemplatesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineTemplatesClient.BeginDelete @@ -151,7 +151,7 @@ func (client *VirtualMachineTemplatesClient) BeginDelete(ctx context.Context, re // Delete - Implements virtual machine template DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *VirtualMachineTemplatesClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, options *VirtualMachineTemplatesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualMachineTemplateName, options) if err != nil { @@ -187,7 +187,7 @@ func (client *VirtualMachineTemplatesClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -198,7 +198,7 @@ func (client *VirtualMachineTemplatesClient) deleteCreateRequest(ctx context.Con // Get - Implements virtual machine template GET method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineTemplateName - Name of the virtual machine template resource. // options - VirtualMachineTemplatesClientGetOptions contains the optional parameters for the VirtualMachineTemplatesClient.Get @@ -238,7 +238,7 @@ func (client *VirtualMachineTemplatesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,8 +254,7 @@ func (client *VirtualMachineTemplatesClient) getHandleResponse(resp *http.Respon } // NewListPager - List of virtualMachineTemplates in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // options - VirtualMachineTemplatesClientListOptions contains the optional parameters for the VirtualMachineTemplatesClient.List // method. func (client *VirtualMachineTemplatesClient) NewListPager(options *VirtualMachineTemplatesClientListOptions) *runtime.Pager[VirtualMachineTemplatesClientListResponse] { @@ -298,7 +297,7 @@ func (client *VirtualMachineTemplatesClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -314,8 +313,7 @@ func (client *VirtualMachineTemplatesClient) listHandleResponse(resp *http.Respo } // NewListByResourceGroupPager - List of virtualMachineTemplates in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // options - VirtualMachineTemplatesClientListByResourceGroupOptions contains the optional parameters for the VirtualMachineTemplatesClient.ListByResourceGroup // method. @@ -363,7 +361,7 @@ func (client *VirtualMachineTemplatesClient) listByResourceGroupCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -380,7 +378,7 @@ func (client *VirtualMachineTemplatesClient) listByResourceGroupHandleResponse(r // Update - API to update certain properties of the virtual machine template resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualMachineTemplateName - Name of the virtual machine template resource. // body - Resource properties to update. @@ -421,7 +419,7 @@ func (client *VirtualMachineTemplatesClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachinetemplates_client_example_test.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachinetemplates_client_example_test.go deleted file mode 100644 index 3c8f0f336ac9..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachinetemplates_client_example_test.go +++ /dev/null @@ -1,163 +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 armconnectedvmware_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/connectedvmware/armconnectedvmware" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/CreateVirtualMachineTemplate.json -func ExampleVirtualMachineTemplatesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachineTemplatesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "testrg", "WebFrontEndTemplate", armconnectedvmware.VirtualMachineTemplate{ - ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - Type: to.Ptr("customLocation"), - }, - Location: to.Ptr("East US"), - Properties: &armconnectedvmware.VirtualMachineTemplateProperties{ - MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/GetVirtualMachineTemplate.json -func ExampleVirtualMachineTemplatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachineTemplatesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "WebFrontEndTemplate", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/UpdateVirtualMachineTemplate.json -func ExampleVirtualMachineTemplatesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachineTemplatesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "testrg", "WebFrontEndTemplate", armconnectedvmware.ResourcePatch{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/DeleteVirtualMachineTemplate.json -func ExampleVirtualMachineTemplatesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachineTemplatesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "WebFrontEndTemplate", &armconnectedvmware.VirtualMachineTemplatesClientBeginDeleteOptions{Force: 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListVirtualMachineTemplates.json -func ExampleVirtualMachineTemplatesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachineTemplatesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListVirtualMachineTemplatesByResourceGroup.json -func ExampleVirtualMachineTemplatesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualMachineTemplatesClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", 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 - } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualnetworks_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualnetworks_client.go index d59affc621e5..ad7e2379bdb6 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualnetworks_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualnetworks_client.go @@ -66,7 +66,7 @@ func NewVirtualNetworksClient(subscriptionID string, credential azcore.TokenCred // BeginCreate - Create Or Update virtual network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualNetworkName - Name of the virtual network resource. // body - Request payload. @@ -88,7 +88,7 @@ func (client *VirtualNetworksClient) BeginCreate(ctx context.Context, resourceGr // Create - Create Or Update virtual network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *VirtualNetworksClient) create(ctx context.Context, resourceGroupName string, virtualNetworkName string, body VirtualNetwork, options *VirtualNetworksClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, virtualNetworkName, body, options) if err != nil { @@ -124,7 +124,7 @@ func (client *VirtualNetworksClient) createCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -132,7 +132,7 @@ func (client *VirtualNetworksClient) createCreateRequest(ctx context.Context, re // BeginDelete - Implements virtual network DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualNetworkName - Name of the virtual network resource. // options - VirtualNetworksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworksClient.BeginDelete @@ -151,7 +151,7 @@ func (client *VirtualNetworksClient) BeginDelete(ctx context.Context, resourceGr // Delete - Implements virtual network DELETE method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview func (client *VirtualNetworksClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) if err != nil { @@ -187,7 +187,7 @@ func (client *VirtualNetworksClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -198,7 +198,7 @@ func (client *VirtualNetworksClient) deleteCreateRequest(ctx context.Context, re // Get - Implements virtual network GET method. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualNetworkName - Name of the virtual network resource. // options - VirtualNetworksClientGetOptions contains the optional parameters for the VirtualNetworksClient.Get method. @@ -237,7 +237,7 @@ func (client *VirtualNetworksClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,8 +253,7 @@ func (client *VirtualNetworksClient) getHandleResponse(resp *http.Response) (Vir } // NewListPager - List of virtualNetworks in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // options - VirtualNetworksClientListOptions contains the optional parameters for the VirtualNetworksClient.List method. func (client *VirtualNetworksClient) NewListPager(options *VirtualNetworksClientListOptions) *runtime.Pager[VirtualNetworksClientListResponse] { return runtime.NewPager(runtime.PagingHandler[VirtualNetworksClientListResponse]{ @@ -296,7 +295,7 @@ func (client *VirtualNetworksClient) listCreateRequest(ctx context.Context, opti return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -312,8 +311,7 @@ func (client *VirtualNetworksClient) listHandleResponse(resp *http.Response) (Vi } // NewListByResourceGroupPager - List of virtualNetworks in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // options - VirtualNetworksClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworksClient.ListByResourceGroup // method. @@ -361,7 +359,7 @@ func (client *VirtualNetworksClient) listByResourceGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -378,7 +376,7 @@ func (client *VirtualNetworksClient) listByResourceGroupHandleResponse(resp *htt // Update - API to update certain properties of the virtual network resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-10-preview +// Generated from API version 2022-07-15-preview // resourceGroupName - The Resource Group Name. // virtualNetworkName - Name of the virtual network resource. // body - Resource properties to update. @@ -418,7 +416,7 @@ func (client *VirtualNetworksClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") + reqQP.Set("api-version", "2022-07-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualnetworks_client_example_test.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualnetworks_client_example_test.go deleted file mode 100644 index 756e87a3d6c9..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualnetworks_client_example_test.go +++ /dev/null @@ -1,163 +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 armconnectedvmware_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/connectedvmware/armconnectedvmware" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/CreateVirtualNetwork.json -func ExampleVirtualNetworksClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualNetworksClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "testrg", "ProdNetwork", armconnectedvmware.VirtualNetwork{ - ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - Type: to.Ptr("customLocation"), - }, - Location: to.Ptr("East US"), - Properties: &armconnectedvmware.VirtualNetworkProperties{ - MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/GetVirtualNetwork.json -func ExampleVirtualNetworksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualNetworksClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "ProdNetwork", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/UpdateVirtualNetwork.json -func ExampleVirtualNetworksClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualNetworksClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "testrg", "ProdNetwork", armconnectedvmware.ResourcePatch{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/DeleteVirtualNetwork.json -func ExampleVirtualNetworksClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualNetworksClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "ProdNetwork", &armconnectedvmware.VirtualNetworksClientBeginDeleteOptions{Force: 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListVirtualNetworks.json -func ExampleVirtualNetworksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualNetworksClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-01-10-preview/examples/ListVirtualNetworksByResourceGroup.json -func ExampleVirtualNetworksClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armconnectedvmware.NewVirtualNetworksClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", 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 - } - } -}