diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/CHANGELOG.md b/sdk/resourcemanager/connectedvmware/armconnectedvmware/CHANGELOG.md index 249ad7f1fa07..5618168c66cc 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/CHANGELOG.md +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/CHANGELOG.md @@ -1,5 +1,140 @@ # Release History +## 1.0.0 (2023-09-18) +### Breaking Changes + +- Type of `ClusterInventoryItem.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `ClusterProperties.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `DatastoreInventoryItem.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `GuestAgentProperties.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `HostInventoryItem.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `HostProperties.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `InventoryItemProperties.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `ResourcePoolInventoryItem.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `ResourcePoolProperties.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `VCenterProperties.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `VirtualMachineInventoryItem.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `VirtualMachineTemplateInventoryItem.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `VirtualMachineTemplateProperties.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `VirtualNetworkInventoryItem.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Type of `VirtualNetworkProperties.ProvisioningState` has been changed from `*string` to `*ProvisioningState` +- Enum `IdentityType` has been removed +- Enum `OsTypeUM` has been removed +- Enum `PatchOperationStartedBy` has been removed +- Enum `PatchOperationStatus` has been removed +- Enum `PatchServiceUsed` has been removed +- Enum `StatusLevelTypes` has been removed +- Enum `StatusTypes` has been removed +- Enum `VMGuestPatchClassificationLinux` has been removed +- Enum `VMGuestPatchClassificationWindows` has been removed +- Enum `VMGuestPatchRebootSetting` has been removed +- Enum `VMGuestPatchRebootStatus` has been removed +- Function `*ClientFactory.NewGuestAgentsClient` has been removed +- Function `*ClientFactory.NewHybridIdentityMetadataClient` has been removed +- Function `*ClientFactory.NewMachineExtensionsClient` has been removed +- Function `*ClientFactory.NewVirtualMachinesClient` has been removed +- Function `NewGuestAgentsClient` has been removed +- Function `*GuestAgentsClient.BeginCreate` has been removed +- Function `*GuestAgentsClient.BeginDelete` has been removed +- Function `*GuestAgentsClient.Get` has been removed +- Function `*GuestAgentsClient.NewListByVMPager` has been removed +- Function `NewHybridIdentityMetadataClient` has been removed +- Function `*HybridIdentityMetadataClient.Create` has been removed +- Function `*HybridIdentityMetadataClient.Delete` has been removed +- Function `*HybridIdentityMetadataClient.Get` has been removed +- Function `*HybridIdentityMetadataClient.NewListByVMPager` has been removed +- Function `NewMachineExtensionsClient` has been removed +- Function `*MachineExtensionsClient.BeginCreateOrUpdate` has been removed +- Function `*MachineExtensionsClient.BeginDelete` has been removed +- Function `*MachineExtensionsClient.Get` has been removed +- Function `*MachineExtensionsClient.NewListPager` has been removed +- Function `*MachineExtensionsClient.BeginUpdate` has been removed +- Function `NewVirtualMachinesClient` has been removed +- Function `*VirtualMachinesClient.BeginAssessPatches` has been removed +- Function `*VirtualMachinesClient.BeginCreate` has been removed +- Function `*VirtualMachinesClient.BeginDelete` has been removed +- Function `*VirtualMachinesClient.Get` has been removed +- Function `*VirtualMachinesClient.BeginInstallPatches` has been removed +- Function `*VirtualMachinesClient.NewListByResourceGroupPager` has been removed +- Function `*VirtualMachinesClient.NewListPager` has been removed +- Function `*VirtualMachinesClient.BeginRestart` has been removed +- Function `*VirtualMachinesClient.BeginStart` has been removed +- Function `*VirtualMachinesClient.BeginStop` has been removed +- Function `*VirtualMachinesClient.BeginUpdate` has been removed +- Struct `AvailablePatchCountByClassification` has been removed +- Struct `ErrorDetail` has been removed +- Struct `GuestAgentProfile` has been removed +- Struct `HybridIdentityMetadata` has been removed +- Struct `HybridIdentityMetadataList` has been removed +- Struct `HybridIdentityMetadataProperties` has been removed +- Struct `Identity` has been removed +- Struct `LinuxParameters` has been removed +- Struct `MachineExtension` has been removed +- Struct `MachineExtensionInstanceViewStatus` has been removed +- Struct `MachineExtensionProperties` has been removed +- Struct `MachineExtensionPropertiesInstanceView` has been removed +- Struct `MachineExtensionUpdate` has been removed +- Struct `MachineExtensionUpdateProperties` has been removed +- Struct `MachineExtensionsListResult` has been removed +- Struct `OsProfile` has been removed +- Struct `OsProfileLinuxConfiguration` has been removed +- Struct `OsProfileUpdate` has been removed +- Struct `OsProfileUpdateLinuxConfiguration` has been removed +- Struct `OsProfileUpdateWindowsConfiguration` has been removed +- Struct `OsProfileWindowsConfiguration` has been removed +- Struct `PatchSettings` has been removed +- Struct `VirtualMachine` has been removed +- Struct `VirtualMachineAssessPatchesResult` has been removed +- Struct `VirtualMachineInstallPatchesParameters` has been removed +- Struct `VirtualMachineInstallPatchesResult` has been removed +- Struct `VirtualMachineProperties` has been removed +- Struct `VirtualMachineUpdate` has been removed +- Struct `VirtualMachineUpdateProperties` has been removed +- Struct `VirtualMachinesList` has been removed +- Struct `WindowsParameters` has been removed + +### Features Added + +- New function `*ClientFactory.NewVMInstanceGuestAgentsClient() *VMInstanceGuestAgentsClient` +- New function `*ClientFactory.NewVMInstanceHybridIdentityMetadataClient() *VMInstanceHybridIdentityMetadataClient` +- New function `*ClientFactory.NewVirtualMachineInstancesClient() *VirtualMachineInstancesClient` +- New function `NewVMInstanceGuestAgentsClient(azcore.TokenCredential, *arm.ClientOptions) (*VMInstanceGuestAgentsClient, error)` +- New function `*VMInstanceGuestAgentsClient.BeginCreate(context.Context, string, GuestAgent, *VMInstanceGuestAgentsClientBeginCreateOptions) (*runtime.Poller[VMInstanceGuestAgentsClientCreateResponse], error)` +- New function `*VMInstanceGuestAgentsClient.BeginDelete(context.Context, string, *VMInstanceGuestAgentsClientBeginDeleteOptions) (*runtime.Poller[VMInstanceGuestAgentsClientDeleteResponse], error)` +- New function `*VMInstanceGuestAgentsClient.Get(context.Context, string, *VMInstanceGuestAgentsClientGetOptions) (VMInstanceGuestAgentsClientGetResponse, error)` +- New function `*VMInstanceGuestAgentsClient.NewListPager(string, *VMInstanceGuestAgentsClientListOptions) *runtime.Pager[VMInstanceGuestAgentsClientListResponse]` +- New function `NewVMInstanceHybridIdentityMetadataClient(azcore.TokenCredential, *arm.ClientOptions) (*VMInstanceHybridIdentityMetadataClient, error)` +- New function `*VMInstanceHybridIdentityMetadataClient.Get(context.Context, string, *VMInstanceHybridIdentityMetadataClientGetOptions) (VMInstanceHybridIdentityMetadataClientGetResponse, error)` +- New function `*VMInstanceHybridIdentityMetadataClient.NewListPager(string, *VMInstanceHybridIdentityMetadataClientListOptions) *runtime.Pager[VMInstanceHybridIdentityMetadataClientListResponse]` +- New function `NewVirtualMachineInstancesClient(azcore.TokenCredential, *arm.ClientOptions) (*VirtualMachineInstancesClient, error)` +- New function `*VirtualMachineInstancesClient.BeginCreateOrUpdate(context.Context, string, VirtualMachineInstance, *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachineInstancesClientCreateOrUpdateResponse], error)` +- New function `*VirtualMachineInstancesClient.BeginDelete(context.Context, string, *VirtualMachineInstancesClientBeginDeleteOptions) (*runtime.Poller[VirtualMachineInstancesClientDeleteResponse], error)` +- New function `*VirtualMachineInstancesClient.Get(context.Context, string, *VirtualMachineInstancesClientGetOptions) (VirtualMachineInstancesClientGetResponse, error)` +- New function `*VirtualMachineInstancesClient.NewListPager(string, *VirtualMachineInstancesClientListOptions) *runtime.Pager[VirtualMachineInstancesClientListResponse]` +- New function `*VirtualMachineInstancesClient.BeginRestart(context.Context, string, *VirtualMachineInstancesClientBeginRestartOptions) (*runtime.Poller[VirtualMachineInstancesClientRestartResponse], error)` +- New function `*VirtualMachineInstancesClient.BeginStart(context.Context, string, *VirtualMachineInstancesClientBeginStartOptions) (*runtime.Poller[VirtualMachineInstancesClientStartResponse], error)` +- New function `*VirtualMachineInstancesClient.BeginStop(context.Context, string, *VirtualMachineInstancesClientBeginStopOptions) (*runtime.Poller[VirtualMachineInstancesClientStopResponse], error)` +- New function `*VirtualMachineInstancesClient.BeginUpdate(context.Context, string, VirtualMachineInstanceUpdate, *VirtualMachineInstancesClientBeginUpdateOptions) (*runtime.Poller[VirtualMachineInstancesClientUpdateResponse], error)` +- New struct `InfrastructureProfile` +- New struct `OsProfileForVMInstance` +- New struct `VMInstanceHybridIdentityMetadata` +- New struct `VMInstanceHybridIdentityMetadataList` +- New struct `VMInstanceHybridIdentityMetadataProperties` +- New struct `VirtualMachineInstance` +- New struct `VirtualMachineInstanceProperties` +- New struct `VirtualMachineInstanceUpdate` +- New struct `VirtualMachineInstanceUpdateProperties` +- New struct `VirtualMachineInstancesList` +- New field `TotalCPUMHz`, `TotalMemoryGB`, `UsedCPUMHz`, `UsedMemoryGB` in struct `ClusterProperties` +- New field `CapacityGB`, `FreeSpaceGB` in struct `DatastoreProperties` +- New field `PrivateLinkScopeResourceID` in struct `GuestAgentProperties` +- New field `CPUMhz`, `DatastoreIDs`, `MemorySizeGB`, `NetworkIDs`, `OverallCPUUsageMHz`, `OverallMemoryUsageGB` in struct `HostProperties` +- New field `InventoryType` in struct `InventoryItemDetails` +- New field `CPUCapacityMHz`, `CPUOverallUsageMHz`, `DatastoreIDs`, `MemCapacityGB`, `MemOverallUsageGB`, `NetworkIDs` in struct `ResourcePoolProperties` +- New field `Cluster` in struct `VirtualMachineInventoryItem` +- New field `ToolsVersion`, `ToolsVersionStatus` in struct `VirtualMachineTemplateInventoryItem` + + ## 0.2.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/autorest.md b/sdk/resourcemanager/connectedvmware/armconnectedvmware/autorest.md index 35684bf13747..9c5657c24def 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.2.1 +module-version: 1.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/client_factory.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/client_factory.go index 3261996ebefe..b22508302f60 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/client_factory.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/client_factory.go @@ -13,7 +13,7 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware @@ -46,33 +46,33 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewClustersClient() *ClustersClient { + subClient, _ := NewClustersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewVirtualMachinesClient() *VirtualMachinesClient { - subClient, _ := NewVirtualMachinesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatastoresClient() *DatastoresClient { + subClient, _ := NewDatastoresClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewResourcePoolsClient() *ResourcePoolsClient { - subClient, _ := NewResourcePoolsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewHostsClient() *HostsClient { + subClient, _ := NewHostsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewClustersClient() *ClustersClient { - subClient, _ := NewClustersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewInventoryItemsClient() *InventoryItemsClient { + subClient, _ := NewInventoryItemsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewHostsClient() *HostsClient { - subClient, _ := NewHostsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatastoresClient() *DatastoresClient { - subClient, _ := NewDatastoresClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewResourcePoolsClient() *ResourcePoolsClient { + subClient, _ := NewResourcePoolsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -81,32 +81,27 @@ func (c *ClientFactory) NewVCentersClient() *VCentersClient { return subClient } -func (c *ClientFactory) NewVirtualMachineTemplatesClient() *VirtualMachineTemplatesClient { - subClient, _ := NewVirtualMachineTemplatesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVMInstanceGuestAgentsClient() *VMInstanceGuestAgentsClient { + subClient, _ := NewVMInstanceGuestAgentsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewVirtualNetworksClient() *VirtualNetworksClient { - subClient, _ := NewVirtualNetworksClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVMInstanceHybridIdentityMetadataClient() *VMInstanceHybridIdentityMetadataClient { + subClient, _ := NewVMInstanceHybridIdentityMetadataClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewInventoryItemsClient() *InventoryItemsClient { - subClient, _ := NewInventoryItemsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient { - subClient, _ := NewHybridIdentityMetadataClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVirtualMachineInstancesClient() *VirtualMachineInstancesClient { + subClient, _ := NewVirtualMachineInstancesClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewMachineExtensionsClient() *MachineExtensionsClient { - subClient, _ := NewMachineExtensionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVirtualMachineTemplatesClient() *VirtualMachineTemplatesClient { + subClient, _ := NewVirtualMachineTemplatesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewGuestAgentsClient() *GuestAgentsClient { - subClient, _ := NewGuestAgentsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVirtualNetworksClient() *VirtualNetworksClient { + subClient, _ := NewVirtualNetworksClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/clusters_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/clusters_client.go index 2daa5ab0c1a1..fd0805fc9968 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/clusters_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/clusters_client.go @@ -13,7 +13,7 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware @@ -56,7 +56,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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - clusterName - Name of the cluster. // - body - Request payload. @@ -67,9 +67,10 @@ func (client *ClustersClient) BeginCreate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClustersClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -78,20 +79,22 @@ 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 2023-10-01 func (client *ClustersClient) create(ctx context.Context, resourceGroupName string, clusterName string, body Cluster, options *ClustersClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -114,16 +117,19 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - clusterName - Name of the cluster. // - options - ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. @@ -133,7 +139,8 @@ func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ClustersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ClustersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClustersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -142,20 +149,22 @@ 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 2023-10-01 func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -178,7 +187,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", "2023-10-01") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -190,23 +199,26 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - clusterName - Name of the cluster. // - options - ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. func (client *ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientGetOptions) (ClustersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return ClustersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClustersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClustersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -229,7 +241,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -246,7 +258,7 @@ func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersCl // NewListPager - List of clusters in a subscription. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - options - ClustersClientListOptions contains the optional parameters for the ClustersClient.NewListPager method. func (client *ClustersClient) NewListPager(options *ClustersClientListOptions) *runtime.Pager[ClustersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ClustersClientListResponse]{ @@ -288,7 +300,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -305,7 +317,7 @@ func (client *ClustersClient) listHandleResponse(resp *http.Response) (ClustersC // NewListByResourceGroupPager - List of clusters in a resource group. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - resourceGroupName - The Resource Group Name. // - options - ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager // method. @@ -353,7 +365,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -371,24 +383,27 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - clusterName - Name of the cluster. // - body - Resource properties to update. // - options - ClustersClientUpdateOptions contains the optional parameters for the ClustersClient.Update method. func (client *ClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, body ResourcePatch, options *ClustersClientUpdateOptions) (ClustersClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, body, options) if err != nil { return ClustersClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClustersClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClustersClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -411,10 +426,13 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. 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 3093b39c4786..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/clusters_client_example_test.go +++ /dev/null @@ -1,262 +0,0 @@ -//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_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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armconnectedvmware.Cluster{ - // Name: to.Ptr("HRCluster"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Clusters"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Clusters/HRCluster"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.ClusterProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().Get(ctx, "testrg", "HRCluster", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armconnectedvmware.Cluster{ - // Name: to.Ptr("HRCluster"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Clusters"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Clusters/HRCluster"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.ClusterProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armconnectedvmware.Cluster{ - // Name: to.Ptr("HRCluster"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Clusters"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Clusters/HRCluster"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.ClusterProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ClustersList = armconnectedvmware.ClustersList{ - // Value: []*armconnectedvmware.Cluster{ - // { - // Name: to.Ptr("HRCluster"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Clusters"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Clusters/HRCluster"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.ClusterProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListByResourceGroupPager("testrg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ClustersList = armconnectedvmware.ClustersList{ - // Value: []*armconnectedvmware.Cluster{ - // { - // Name: to.Ptr("HRCluster"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Clusters"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Clusters/HRCluster"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.ClusterProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/constants.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/constants.go index 0c2ea210e540..15e80280836d 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/constants.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/constants.go @@ -13,13 +13,13 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware const ( moduleName = "armconnectedvmware" - moduleVersion = "v0.2.1" + moduleVersion = "v1.0.0" ) // CreatedByType - The type of identity that created the resource. @@ -126,22 +126,6 @@ func PossibleIPAddressAllocationMethodValues() []IPAddressAllocationMethod { } } -// IdentityType - The type of managed service identity. -type IdentityType string - -const ( - IdentityTypeNone IdentityType = "None" - IdentityTypeSystemAssigned IdentityType = "SystemAssigned" -) - -// PossibleIdentityTypeValues returns the possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{ - IdentityTypeNone, - IdentityTypeSystemAssigned, - } -} - // InventoryType - The inventory type. type InventoryType string @@ -210,86 +194,6 @@ func PossibleOsTypeValues() []OsType { } } -// OsTypeUM - The operating system type of the machine. -type OsTypeUM string - -const ( - OsTypeUMLinux OsTypeUM = "Linux" - OsTypeUMWindows OsTypeUM = "Windows" -) - -// PossibleOsTypeUMValues returns the possible values for the OsTypeUM const type. -func PossibleOsTypeUMValues() []OsTypeUM { - return []OsTypeUM{ - OsTypeUMLinux, - OsTypeUMWindows, - } -} - -// PatchOperationStartedBy - Indicates if operation was triggered by user or by platform. -type PatchOperationStartedBy string - -const ( - PatchOperationStartedByPlatform PatchOperationStartedBy = "Platform" - PatchOperationStartedByUser PatchOperationStartedBy = "User" -) - -// PossiblePatchOperationStartedByValues returns the possible values for the PatchOperationStartedBy const type. -func PossiblePatchOperationStartedByValues() []PatchOperationStartedBy { - return []PatchOperationStartedBy{ - PatchOperationStartedByPlatform, - PatchOperationStartedByUser, - } -} - -// PatchOperationStatus - The overall success or failure status of the operation. It remains "InProgress" until the operation -// completes. At that point it will become "Unknown", "Failed", "Succeeded", or -// "CompletedWithWarnings." -type PatchOperationStatus string - -const ( - PatchOperationStatusCompletedWithWarnings PatchOperationStatus = "CompletedWithWarnings" - PatchOperationStatusFailed PatchOperationStatus = "Failed" - PatchOperationStatusInProgress PatchOperationStatus = "InProgress" - PatchOperationStatusSucceeded PatchOperationStatus = "Succeeded" - PatchOperationStatusUnknown PatchOperationStatus = "Unknown" -) - -// PossiblePatchOperationStatusValues returns the possible values for the PatchOperationStatus const type. -func PossiblePatchOperationStatusValues() []PatchOperationStatus { - return []PatchOperationStatus{ - PatchOperationStatusCompletedWithWarnings, - PatchOperationStatusFailed, - PatchOperationStatusInProgress, - PatchOperationStatusSucceeded, - PatchOperationStatusUnknown, - } -} - -// PatchServiceUsed - Specifies the patch service used for the operation. -type PatchServiceUsed string - -const ( - PatchServiceUsedAPT PatchServiceUsed = "APT" - PatchServiceUsedUnknown PatchServiceUsed = "Unknown" - PatchServiceUsedWU PatchServiceUsed = "WU" - PatchServiceUsedWUWSUS PatchServiceUsed = "WU_WSUS" - PatchServiceUsedYUM PatchServiceUsed = "YUM" - PatchServiceUsedZypper PatchServiceUsed = "Zypper" -) - -// PossiblePatchServiceUsedValues returns the possible values for the PatchServiceUsed const type. -func PossiblePatchServiceUsedValues() []PatchServiceUsed { - return []PatchServiceUsed{ - PatchServiceUsedAPT, - PatchServiceUsedUnknown, - PatchServiceUsedWU, - PatchServiceUsedWUWSUS, - PatchServiceUsedYUM, - PatchServiceUsedZypper, - } -} - // PowerOnBootOption - Defines the options for power on boot. type PowerOnBootOption string @@ -372,128 +276,6 @@ func PossibleSCSIControllerTypeValues() []SCSIControllerType { } } -// StatusLevelTypes - The level code. -type StatusLevelTypes string - -const ( - StatusLevelTypesError StatusLevelTypes = "Error" - StatusLevelTypesInfo StatusLevelTypes = "Info" - StatusLevelTypesWarning StatusLevelTypes = "Warning" -) - -// PossibleStatusLevelTypesValues returns the possible values for the StatusLevelTypes const type. -func PossibleStatusLevelTypesValues() []StatusLevelTypes { - return []StatusLevelTypes{ - StatusLevelTypesError, - StatusLevelTypesInfo, - StatusLevelTypesWarning, - } -} - -// StatusTypes - The status of the hybrid machine agent. -type StatusTypes string - -const ( - StatusTypesConnected StatusTypes = "Connected" - StatusTypesDisconnected StatusTypes = "Disconnected" - StatusTypesError StatusTypes = "Error" -) - -// PossibleStatusTypesValues returns the possible values for the StatusTypes const type. -func PossibleStatusTypesValues() []StatusTypes { - return []StatusTypes{ - StatusTypesConnected, - StatusTypesDisconnected, - StatusTypesError, - } -} - -type VMGuestPatchClassificationLinux string - -const ( - VMGuestPatchClassificationLinuxCritical VMGuestPatchClassificationLinux = "Critical" - VMGuestPatchClassificationLinuxOther VMGuestPatchClassificationLinux = "Other" - VMGuestPatchClassificationLinuxSecurity VMGuestPatchClassificationLinux = "Security" -) - -// PossibleVMGuestPatchClassificationLinuxValues returns the possible values for the VMGuestPatchClassificationLinux const type. -func PossibleVMGuestPatchClassificationLinuxValues() []VMGuestPatchClassificationLinux { - return []VMGuestPatchClassificationLinux{ - VMGuestPatchClassificationLinuxCritical, - VMGuestPatchClassificationLinuxOther, - VMGuestPatchClassificationLinuxSecurity, - } -} - -type VMGuestPatchClassificationWindows string - -const ( - VMGuestPatchClassificationWindowsCritical VMGuestPatchClassificationWindows = "Critical" - VMGuestPatchClassificationWindowsDefinition VMGuestPatchClassificationWindows = "Definition" - VMGuestPatchClassificationWindowsFeaturePack VMGuestPatchClassificationWindows = "FeaturePack" - VMGuestPatchClassificationWindowsSecurity VMGuestPatchClassificationWindows = "Security" - VMGuestPatchClassificationWindowsServicePack VMGuestPatchClassificationWindows = "ServicePack" - VMGuestPatchClassificationWindowsTools VMGuestPatchClassificationWindows = "Tools" - VMGuestPatchClassificationWindowsUpdateRollUp VMGuestPatchClassificationWindows = "UpdateRollUp" - VMGuestPatchClassificationWindowsUpdates VMGuestPatchClassificationWindows = "Updates" -) - -// PossibleVMGuestPatchClassificationWindowsValues returns the possible values for the VMGuestPatchClassificationWindows const type. -func PossibleVMGuestPatchClassificationWindowsValues() []VMGuestPatchClassificationWindows { - return []VMGuestPatchClassificationWindows{ - VMGuestPatchClassificationWindowsCritical, - VMGuestPatchClassificationWindowsDefinition, - VMGuestPatchClassificationWindowsFeaturePack, - VMGuestPatchClassificationWindowsSecurity, - VMGuestPatchClassificationWindowsServicePack, - VMGuestPatchClassificationWindowsTools, - VMGuestPatchClassificationWindowsUpdateRollUp, - VMGuestPatchClassificationWindowsUpdates, - } -} - -// VMGuestPatchRebootSetting - Defines when it is acceptable to reboot a VM during a software update operation. -type VMGuestPatchRebootSetting string - -const ( - VMGuestPatchRebootSettingAlways VMGuestPatchRebootSetting = "Always" - VMGuestPatchRebootSettingIfRequired VMGuestPatchRebootSetting = "IfRequired" - VMGuestPatchRebootSettingNever VMGuestPatchRebootSetting = "Never" -) - -// PossibleVMGuestPatchRebootSettingValues returns the possible values for the VMGuestPatchRebootSetting const type. -func PossibleVMGuestPatchRebootSettingValues() []VMGuestPatchRebootSetting { - return []VMGuestPatchRebootSetting{ - VMGuestPatchRebootSettingAlways, - VMGuestPatchRebootSettingIfRequired, - VMGuestPatchRebootSettingNever, - } -} - -// VMGuestPatchRebootStatus - The reboot state of the VM following completion of the operation. -type VMGuestPatchRebootStatus string - -const ( - VMGuestPatchRebootStatusCompleted VMGuestPatchRebootStatus = "Completed" - VMGuestPatchRebootStatusFailed VMGuestPatchRebootStatus = "Failed" - VMGuestPatchRebootStatusNotNeeded VMGuestPatchRebootStatus = "NotNeeded" - VMGuestPatchRebootStatusRequired VMGuestPatchRebootStatus = "Required" - VMGuestPatchRebootStatusStarted VMGuestPatchRebootStatus = "Started" - VMGuestPatchRebootStatusUnknown VMGuestPatchRebootStatus = "Unknown" -) - -// PossibleVMGuestPatchRebootStatusValues returns the possible values for the VMGuestPatchRebootStatus const type. -func PossibleVMGuestPatchRebootStatusValues() []VMGuestPatchRebootStatus { - return []VMGuestPatchRebootStatus{ - VMGuestPatchRebootStatusCompleted, - VMGuestPatchRebootStatusFailed, - VMGuestPatchRebootStatusNotNeeded, - VMGuestPatchRebootStatusRequired, - VMGuestPatchRebootStatusStarted, - VMGuestPatchRebootStatusUnknown, - } -} - // VirtualSCSISharing - Defines the sharing mode for sharing the SCSI bus. type VirtualSCSISharing string diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/datastores_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/datastores_client.go index 254dedfb7f77..08511095f13e 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/datastores_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/datastores_client.go @@ -13,7 +13,7 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware @@ -56,7 +56,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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - datastoreName - Name of the datastore. // - body - Request payload. @@ -67,9 +67,10 @@ func (client *DatastoresClient) BeginCreate(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatastoresClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatastoresClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatastoresClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -78,20 +79,22 @@ 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 2023-10-01 func (client *DatastoresClient) create(ctx context.Context, resourceGroupName string, datastoreName string, body Datastore, options *DatastoresClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, datastoreName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -114,16 +117,19 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - datastoreName - Name of the datastore. // - options - DatastoresClientBeginDeleteOptions contains the optional parameters for the DatastoresClient.BeginDelete method. @@ -133,7 +139,8 @@ func (client *DatastoresClient) BeginDelete(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - return runtime.NewPoller[DatastoresClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatastoresClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatastoresClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -142,20 +149,22 @@ 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 2023-10-01 func (client *DatastoresClient) deleteOperation(ctx context.Context, resourceGroupName string, datastoreName string, options *DatastoresClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, datastoreName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -178,7 +187,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", "2023-10-01") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -190,23 +199,26 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - datastoreName - Name of the datastore. // - options - DatastoresClientGetOptions contains the optional parameters for the DatastoresClient.Get method. func (client *DatastoresClient) Get(ctx context.Context, resourceGroupName string, datastoreName string, options *DatastoresClientGetOptions) (DatastoresClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, datastoreName, options) if err != nil { return DatastoresClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatastoresClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatastoresClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatastoresClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -229,7 +241,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -246,7 +258,7 @@ func (client *DatastoresClient) getHandleResponse(resp *http.Response) (Datastor // NewListPager - List of datastores in a subscription. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - options - DatastoresClientListOptions contains the optional parameters for the DatastoresClient.NewListPager method. func (client *DatastoresClient) NewListPager(options *DatastoresClientListOptions) *runtime.Pager[DatastoresClientListResponse] { return runtime.NewPager(runtime.PagingHandler[DatastoresClientListResponse]{ @@ -288,7 +300,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -305,7 +317,7 @@ func (client *DatastoresClient) listHandleResponse(resp *http.Response) (Datasto // NewListByResourceGroupPager - List of datastores in a resource group. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - resourceGroupName - The Resource Group Name. // - options - DatastoresClientListByResourceGroupOptions contains the optional parameters for the DatastoresClient.NewListByResourceGroupPager // method. @@ -353,7 +365,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -371,24 +383,27 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - datastoreName - Name of the datastore. // - body - Resource properties to update. // - options - DatastoresClientUpdateOptions contains the optional parameters for the DatastoresClient.Update method. func (client *DatastoresClient) Update(ctx context.Context, resourceGroupName string, datastoreName string, body ResourcePatch, options *DatastoresClientUpdateOptions) (DatastoresClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, datastoreName, body, options) if err != nil { return DatastoresClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatastoresClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatastoresClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatastoresClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -411,10 +426,13 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. 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 a4df9a0ed3b7..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/datastores_client_example_test.go +++ /dev/null @@ -1,262 +0,0 @@ -//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_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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatastoresClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Datastore = armconnectedvmware.Datastore{ - // Name: to.Ptr("HRDatastore"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Datastores"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Datastores/HRDatastore"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.DatastoreProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr(armconnectedvmware.ProvisioningStateSucceeded), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatastoresClient().Get(ctx, "testrg", "HRDatastore", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Datastore = armconnectedvmware.Datastore{ - // Name: to.Ptr("HRDatastore"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Datastores"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Datastores/HRDatastore"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.DatastoreProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr(armconnectedvmware.ProvisioningStateSucceeded), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatastoresClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Datastore = armconnectedvmware.Datastore{ - // Name: to.Ptr("HRDatastore"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Datastores"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Datastores/HRDatastore"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.DatastoreProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr(armconnectedvmware.ProvisioningStateSucceeded), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatastoresClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatastoresClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatastoresList = armconnectedvmware.DatastoresList{ - // Value: []*armconnectedvmware.Datastore{ - // { - // Name: to.Ptr("HRDatastore"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Datastores"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Datastores/HRDatastore"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.DatastoreProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr(armconnectedvmware.ProvisioningStateSucceeded), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatastoresClient().NewListByResourceGroupPager("testrg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatastoresList = armconnectedvmware.DatastoresList{ - // Value: []*armconnectedvmware.Datastore{ - // { - // Name: to.Ptr("HRDatastore"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Datastores"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Datastores/HRDatastore"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.DatastoreProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr(armconnectedvmware.ProvisioningStateSucceeded), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/go.mod b/sdk/resourcemanager/connectedvmware/armconnectedvmware/go.mod index 7bcb16f2fc98..11f7063c555f 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.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // 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 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/go.sum +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= 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/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/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/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +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.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +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 deleted file mode 100644 index b694e4615a63..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/guestagents_client.go +++ /dev/null @@ -1,326 +0,0 @@ -//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" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// GuestAgentsClient contains the methods for the GuestAgents group. -// Don't use this type directly, use NewGuestAgentsClient() instead. -type GuestAgentsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewGuestAgentsClient creates a new instance of GuestAgentsClient 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 NewGuestAgentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GuestAgentsClient, error) { - cl, err := arm.NewClient(moduleName+".GuestAgentsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GuestAgentsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreate - Create Or Update GuestAgent. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the vm. -// - name - Name of the guestAgents. -// - body - Request payload. -// - options - GuestAgentsClientBeginCreateOptions contains the optional parameters for the GuestAgentsClient.BeginCreate method. -func (client *GuestAgentsClient) BeginCreate(ctx context.Context, resourceGroupName string, virtualMachineName string, name string, body GuestAgent, options *GuestAgentsClientBeginCreateOptions) (*runtime.Poller[GuestAgentsClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, virtualMachineName, name, body, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GuestAgentsClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[GuestAgentsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - Create Or Update GuestAgent. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-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 { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createCreateRequest creates the Create request. -func (client *GuestAgentsClient) createCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, name string, body GuestAgent, options *GuestAgentsClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" - 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)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) -} - -// BeginDelete - Implements GuestAgent DELETE method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the vm. -// - name - Name of the GuestAgent. -// - options - GuestAgentsClientBeginDeleteOptions contains the optional parameters for the GuestAgentsClient.BeginDelete method. -func (client *GuestAgentsClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualMachineName string, name string, options *GuestAgentsClientBeginDeleteOptions) (*runtime.Poller[GuestAgentsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, virtualMachineName, name, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[GuestAgentsClientDeleteResponse](resp, client.internal.Pipeline(), nil) - } else { - return runtime.NewPollerFromResumeToken[GuestAgentsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Implements GuestAgent DELETE method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-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 { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *GuestAgentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, name string, options *GuestAgentsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" - 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)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Implements GuestAgent GET method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the vm. -// - name - Name of the GuestAgent. -// - options - GuestAgentsClientGetOptions contains the optional parameters for the GuestAgentsClient.Get method. -func (client *GuestAgentsClient) Get(ctx context.Context, resourceGroupName string, virtualMachineName string, name string, options *GuestAgentsClientGetOptions) (GuestAgentsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, virtualMachineName, name, options) - if err != nil { - return GuestAgentsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GuestAgentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GuestAgentsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *GuestAgentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, name string, options *GuestAgentsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" - 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)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *GuestAgentsClient) getHandleResponse(resp *http.Response) (GuestAgentsClientGetResponse, error) { - result := GuestAgentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GuestAgent); err != nil { - return GuestAgentsClientGetResponse{}, err - } - return result, nil -} - -// NewListByVMPager - Returns the list of GuestAgent of the given vm. -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the vm. -// - options - GuestAgentsClientListByVMOptions contains the optional parameters for the GuestAgentsClient.NewListByVMPager -// 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 { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *GuestAgentsClientListByVMResponse) (GuestAgentsClientListByVMResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByVMCreateRequest(ctx, resourceGroupName, virtualMachineName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return GuestAgentsClientListByVMResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GuestAgentsClientListByVMResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GuestAgentsClientListByVMResponse{}, runtime.NewResponseError(resp) - } - return client.listByVMHandleResponse(resp) - }, - }) -} - -// listByVMCreateRequest creates the ListByVM request. -func (client *GuestAgentsClient) listByVMCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *GuestAgentsClientListByVMOptions) (*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") - } - 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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-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{} - if err := runtime.UnmarshalAsJSON(resp, &result.GuestAgentList); err != nil { - return GuestAgentsClientListByVMResponse{}, 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 f00920289a12..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/guestagents_client_example_test.go +++ /dev/null @@ -1,161 +0,0 @@ -//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_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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGuestAgentsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GuestAgent = armconnectedvmware.GuestAgent{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VitualMachines/guestAgents"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VitualMachines/ContosoVm/guestAgents/default"), - // Properties: &armconnectedvmware.GuestAgentProperties{ - // ProvisioningAction: to.Ptr(armconnectedvmware.ProvisioningActionInstall), - // ProvisioningState: to.Ptr("Succeeded"), - // Status: to.Ptr("connected"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGuestAgentsClient().Get(ctx, "testrg", "ContosoVm", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GuestAgent = armconnectedvmware.GuestAgent{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VitualMachines/guestAgents"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VitualMachines/ContosoVm/guestAgents/default"), - // Properties: &armconnectedvmware.GuestAgentProperties{ - // ProvisioningAction: to.Ptr(armconnectedvmware.ProvisioningActionInstall), - // ProvisioningState: to.Ptr("Succeeded"), - // Status: to.Ptr("connected"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGuestAgentsClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGuestAgentsClient().NewListByVMPager("testrg", "ContosoVm", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GuestAgentList = armconnectedvmware.GuestAgentList{ - // Value: []*armconnectedvmware.GuestAgent{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VitualMachines/guestAgents"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VitualMachines/ContosoVm/guestAgents/default"), - // Properties: &armconnectedvmware.GuestAgentProperties{ - // ProvisioningAction: to.Ptr(armconnectedvmware.ProvisioningActionInstall), - // ProvisioningState: to.Ptr("Succeeded"), - // Status: to.Ptr("connected"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hosts_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/hosts_client.go index 919a384f65c4..70f5edbf6c62 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hosts_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/hosts_client.go @@ -13,7 +13,7 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware @@ -56,7 +56,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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - hostName - Name of the host. // - body - Request payload. @@ -67,9 +67,10 @@ func (client *HostsClient) BeginCreate(ctx context.Context, resourceGroupName st if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HostsClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HostsClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[HostsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -78,20 +79,22 @@ 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 2023-10-01 func (client *HostsClient) create(ctx context.Context, resourceGroupName string, hostName string, body Host, options *HostsClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, hostName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -114,16 +117,19 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - hostName - Name of the host. // - options - HostsClientBeginDeleteOptions contains the optional parameters for the HostsClient.BeginDelete method. @@ -133,7 +139,8 @@ func (client *HostsClient) BeginDelete(ctx context.Context, resourceGroupName st if err != nil { return nil, err } - return runtime.NewPoller[HostsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[HostsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[HostsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -142,20 +149,22 @@ 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 2023-10-01 func (client *HostsClient) deleteOperation(ctx context.Context, resourceGroupName string, hostName string, options *HostsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -178,7 +187,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", "2023-10-01") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -190,23 +199,26 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - hostName - Name of the host. // - options - HostsClientGetOptions contains the optional parameters for the HostsClient.Get method. func (client *HostsClient) Get(ctx context.Context, resourceGroupName string, hostName string, options *HostsClientGetOptions) (HostsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, hostName, options) if err != nil { return HostsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HostsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HostsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HostsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -229,7 +241,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -246,7 +258,7 @@ func (client *HostsClient) getHandleResponse(resp *http.Response) (HostsClientGe // NewListPager - List of hosts in a subscription. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - options - HostsClientListOptions contains the optional parameters for the HostsClient.NewListPager method. func (client *HostsClient) NewListPager(options *HostsClientListOptions) *runtime.Pager[HostsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[HostsClientListResponse]{ @@ -288,7 +300,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -305,7 +317,7 @@ func (client *HostsClient) listHandleResponse(resp *http.Response) (HostsClientL // NewListByResourceGroupPager - List of hosts in a resource group. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - resourceGroupName - The Resource Group Name. // - options - HostsClientListByResourceGroupOptions contains the optional parameters for the HostsClient.NewListByResourceGroupPager // method. @@ -353,7 +365,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -371,24 +383,27 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - hostName - Name of the host. // - body - Resource properties to update. // - options - HostsClientUpdateOptions contains the optional parameters for the HostsClient.Update method. func (client *HostsClient) Update(ctx context.Context, resourceGroupName string, hostName string, body ResourcePatch, options *HostsClientUpdateOptions) (HostsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, hostName, body, options) if err != nil { return HostsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HostsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HostsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HostsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -411,10 +426,13 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. 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 c802a27f39e6..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hosts_client_example_test.go +++ /dev/null @@ -1,262 +0,0 @@ -//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_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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewHostsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Host = armconnectedvmware.Host{ - // Name: to.Ptr("HRHost"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Hosts"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Hosts/HRHost"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.HostProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHostsClient().Get(ctx, "testrg", "HRHost", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Host = armconnectedvmware.Host{ - // Name: to.Ptr("HRHost"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Hosts"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Hosts/HRHost"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.HostProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHostsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Host = armconnectedvmware.Host{ - // Name: to.Ptr("HRHost"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Hosts"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Hosts/HRHost"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.HostProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewHostsClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHostsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.HostsList = armconnectedvmware.HostsList{ - // Value: []*armconnectedvmware.Host{ - // { - // Name: to.Ptr("HRHost"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Hosts"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Hosts/HRHost"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.HostProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHostsClient().NewListByResourceGroupPager("testrg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.HostsList = armconnectedvmware.HostsList{ - // Value: []*armconnectedvmware.Host{ - // { - // Name: to.Ptr("HRHost"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/Hosts"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/Hosts/HRHost"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.HostProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hybrididentitymetadata_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/hybrididentitymetadata_client.go deleted file mode 100644 index 5b1aaf0dc2d2..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hybrididentitymetadata_client.go +++ /dev/null @@ -1,304 +0,0 @@ -//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" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// HybridIdentityMetadataClient contains the methods for the HybridIdentityMetadata group. -// Don't use this type directly, use NewHybridIdentityMetadataClient() instead. -type HybridIdentityMetadataClient struct { - internal *arm.Client - subscriptionID string -} - -// NewHybridIdentityMetadataClient creates a new instance of HybridIdentityMetadataClient 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 NewHybridIdentityMetadataClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HybridIdentityMetadataClient, error) { - cl, err := arm.NewClient(moduleName+".HybridIdentityMetadataClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &HybridIdentityMetadataClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create Or Update HybridIdentityMetadata. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the vm. -// - metadataName - Name of the hybridIdentityMetadata. -// - body - Request payload. -// - options - HybridIdentityMetadataClientCreateOptions contains the optional parameters for the HybridIdentityMetadataClient.Create -// method. -func (client *HybridIdentityMetadataClient) Create(ctx context.Context, resourceGroupName string, virtualMachineName string, metadataName string, body HybridIdentityMetadata, options *HybridIdentityMetadataClientCreateOptions) (HybridIdentityMetadataClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, resourceGroupName, virtualMachineName, metadataName, body, options) - if err != nil { - return HybridIdentityMetadataClientCreateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return HybridIdentityMetadataClientCreateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HybridIdentityMetadataClientCreateResponse{}, runtime.NewResponseError(resp) - } - return client.createHandleResponse(resp) -} - -// createCreateRequest creates the Create request. -func (client *HybridIdentityMetadataClient) createCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, metadataName string, body HybridIdentityMetadata, options *HybridIdentityMetadataClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - 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)) - if metadataName == "" { - return nil, errors.New("parameter metadataName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{metadataName}", url.PathEscape(metadataName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) -} - -// createHandleResponse handles the Create response. -func (client *HybridIdentityMetadataClient) createHandleResponse(resp *http.Response) (HybridIdentityMetadataClientCreateResponse, error) { - result := HybridIdentityMetadataClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.HybridIdentityMetadata); err != nil { - return HybridIdentityMetadataClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Implements HybridIdentityMetadata DELETE method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the vm. -// - metadataName - Name of the HybridIdentityMetadata. -// - options - HybridIdentityMetadataClientDeleteOptions contains the optional parameters for the HybridIdentityMetadataClient.Delete -// method. -func (client *HybridIdentityMetadataClient) Delete(ctx context.Context, resourceGroupName string, virtualMachineName string, metadataName string, options *HybridIdentityMetadataClientDeleteOptions) (HybridIdentityMetadataClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualMachineName, metadataName, options) - if err != nil { - return HybridIdentityMetadataClientDeleteResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return HybridIdentityMetadataClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return HybridIdentityMetadataClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return HybridIdentityMetadataClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *HybridIdentityMetadataClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, metadataName string, options *HybridIdentityMetadataClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - 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)) - if metadataName == "" { - return nil, errors.New("parameter metadataName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{metadataName}", url.PathEscape(metadataName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Implements HybridIdentityMetadata GET method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the vm. -// - metadataName - Name of the HybridIdentityMetadata. -// - options - HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get -// method. -func (client *HybridIdentityMetadataClient) Get(ctx context.Context, resourceGroupName string, virtualMachineName string, metadataName string, options *HybridIdentityMetadataClientGetOptions) (HybridIdentityMetadataClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, virtualMachineName, metadataName, options) - if err != nil { - return HybridIdentityMetadataClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return HybridIdentityMetadataClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HybridIdentityMetadataClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *HybridIdentityMetadataClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, metadataName string, options *HybridIdentityMetadataClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - 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)) - if metadataName == "" { - return nil, errors.New("parameter metadataName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{metadataName}", url.PathEscape(metadataName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *HybridIdentityMetadataClient) getHandleResponse(resp *http.Response) (HybridIdentityMetadataClientGetResponse, error) { - result := HybridIdentityMetadataClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.HybridIdentityMetadata); err != nil { - return HybridIdentityMetadataClientGetResponse{}, err - } - return result, nil -} - -// NewListByVMPager - Returns the list of HybridIdentityMetadata of the given vm. -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the vm. -// - options - HybridIdentityMetadataClientListByVMOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListByVMPager -// 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 { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *HybridIdentityMetadataClientListByVMResponse) (HybridIdentityMetadataClientListByVMResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByVMCreateRequest(ctx, resourceGroupName, virtualMachineName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return HybridIdentityMetadataClientListByVMResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return HybridIdentityMetadataClientListByVMResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HybridIdentityMetadataClientListByVMResponse{}, runtime.NewResponseError(resp) - } - return client.listByVMHandleResponse(resp) - }, - }) -} - -// listByVMCreateRequest creates the ListByVM request. -func (client *HybridIdentityMetadataClient) listByVMCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *HybridIdentityMetadataClientListByVMOptions) (*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") - } - 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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-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{} - if err := runtime.UnmarshalAsJSON(resp, &result.HybridIdentityMetadataList); err != nil { - return HybridIdentityMetadataClientListByVMResponse{}, 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 5a197feda9df..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/hybrididentitymetadata_client_example_test.go +++ /dev/null @@ -1,159 +0,0 @@ -//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_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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHybridIdentityMetadataClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HybridIdentityMetadata = armconnectedvmware.HybridIdentityMetadata{ - // Name: to.Ptr("testItem"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VitualMachines/hybridIdentityMetadatas"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VitualMachines/ContosoVm/hybridIdentityMetadatas/default"), - // Properties: &armconnectedvmware.HybridIdentityMetadataProperties{ - // Identity: &armconnectedvmware.Identity{ - // Type: to.Ptr(armconnectedvmware.IdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), - // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), - // }, - // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), - // VMID: to.Ptr("f8b82dff-38ef-4220-99ef-d3a3f86ddc6c"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHybridIdentityMetadataClient().Get(ctx, "testrg", "ContosoVm", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HybridIdentityMetadata = armconnectedvmware.HybridIdentityMetadata{ - // Name: to.Ptr("testItem"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VitualMachines/hybridIdentityMetadatas"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VitualMachines/ContosoVm/hybridIdentityMetadatas/default"), - // Properties: &armconnectedvmware.HybridIdentityMetadataProperties{ - // Identity: &armconnectedvmware.Identity{ - // Type: to.Ptr(armconnectedvmware.IdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), - // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), - // }, - // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), - // VMID: to.Ptr("f8b82dff-38ef-4220-99ef-d3a3f86ddc6c"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewHybridIdentityMetadataClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHybridIdentityMetadataClient().NewListByVMPager("testrg", "ContosoVm", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.HybridIdentityMetadataList = armconnectedvmware.HybridIdentityMetadataList{ - // Value: []*armconnectedvmware.HybridIdentityMetadata{ - // { - // Name: to.Ptr("testItem"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VitualMachines/hybridIdentityMetadatas"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VitualMachines/ContosoVm/hybridIdentityMetadatas/default"), - // Properties: &armconnectedvmware.HybridIdentityMetadataProperties{ - // Identity: &armconnectedvmware.Identity{ - // Type: to.Ptr(armconnectedvmware.IdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), - // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), - // }, - // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), - // VMID: to.Ptr("f8b82dff-38ef-4220-99ef-d3a3f86ddc6c"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/interfaces.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/interfaces.go new file mode 100644 index 000000000000..470cf00a7a15 --- /dev/null +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/interfaces.go @@ -0,0 +1,28 @@ +//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. +// Code generated by @autorest/go. DO NOT EDIT. + +package armconnectedvmware + +// InventoryItemPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetInventoryItemProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ClusterInventoryItem, *DatastoreInventoryItem, *HostInventoryItem, *InventoryItemProperties, *ResourcePoolInventoryItem, +// - *VirtualMachineInventoryItem, *VirtualMachineTemplateInventoryItem, *VirtualNetworkInventoryItem +type InventoryItemPropertiesClassification interface { + // GetInventoryItemProperties returns the InventoryItemProperties content of the underlying type. + GetInventoryItemProperties() *InventoryItemProperties +} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/inventoryitems_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/inventoryitems_client.go index 3de03e5139f2..858223486c97 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/inventoryitems_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/inventoryitems_client.go @@ -13,7 +13,7 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware @@ -55,25 +55,28 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - vcenterName - Name of the vCenter. // - inventoryItemName - Name of the inventoryItem. // - body - Request payload. // - options - InventoryItemsClientCreateOptions contains the optional parameters for the InventoryItemsClient.Create method. func (client *InventoryItemsClient) Create(ctx context.Context, resourceGroupName string, vcenterName string, inventoryItemName string, body InventoryItem, options *InventoryItemsClientCreateOptions) (InventoryItemsClientCreateResponse, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, vcenterName, inventoryItemName, body, options) if err != nil { return InventoryItemsClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return InventoryItemsClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return InventoryItemsClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InventoryItemsClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -100,10 +103,13 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // createHandleResponse handles the Create response. @@ -118,22 +124,24 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - vcenterName - Name of the vCenter. // - inventoryItemName - Name of the inventoryItem. // - options - InventoryItemsClientDeleteOptions contains the optional parameters for the InventoryItemsClient.Delete method. func (client *InventoryItemsClient) Delete(ctx context.Context, resourceGroupName string, vcenterName string, inventoryItemName string, options *InventoryItemsClientDeleteOptions) (InventoryItemsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, vcenterName, inventoryItemName, options) if err != nil { return InventoryItemsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return InventoryItemsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return InventoryItemsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return InventoryItemsClientDeleteResponse{}, err } return InventoryItemsClientDeleteResponse{}, nil } @@ -162,7 +170,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -171,24 +179,27 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - vcenterName - Name of the vCenter. // - inventoryItemName - Name of the inventoryItem. // - options - InventoryItemsClientGetOptions contains the optional parameters for the InventoryItemsClient.Get method. func (client *InventoryItemsClient) Get(ctx context.Context, resourceGroupName string, vcenterName string, inventoryItemName string, options *InventoryItemsClientGetOptions) (InventoryItemsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vcenterName, inventoryItemName, options) if err != nil { return InventoryItemsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return InventoryItemsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return InventoryItemsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InventoryItemsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -215,7 +226,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -232,7 +243,7 @@ func (client *InventoryItemsClient) getHandleResponse(resp *http.Response) (Inve // NewListByVCenterPager - Returns the list of inventoryItems of the given vCenter. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - resourceGroupName - The Resource Group Name. // - vcenterName - Name of the vCenter. // - options - InventoryItemsClientListByVCenterOptions contains the optional parameters for the InventoryItemsClient.NewListByVCenterPager @@ -285,7 +296,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", "2023-10-01") 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 6048d98a262d..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/inventoryitems_client_example_test.go +++ /dev/null @@ -1,140 +0,0 @@ -//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_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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInventoryItemsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InventoryItem = armconnectedvmware.InventoryItem{ - // Name: to.Ptr("testItem"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VCenters/InventoryItems"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter/InventoryItems/testItem"), - // Properties: &armconnectedvmware.ResourcePoolInventoryItem{ - // InventoryType: to.Ptr(armconnectedvmware.InventoryTypeResourcePool), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInventoryItemsClient().Get(ctx, "testrg", "ContosoVCenter", "testItem", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InventoryItem = armconnectedvmware.InventoryItem{ - // Name: to.Ptr("testItem"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VCenters/InventoryItems"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter/InventoryItems/testItem"), - // Properties: &armconnectedvmware.ResourcePoolInventoryItem{ - // InventoryType: to.Ptr(armconnectedvmware.InventoryTypeResourcePool), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewInventoryItemsClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInventoryItemsClient().NewListByVCenterPager("testrg", "ContosoVCenter", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InventoryItemsList = armconnectedvmware.InventoryItemsList{ - // Value: []*armconnectedvmware.InventoryItem{ - // { - // Name: to.Ptr("testItem"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VCenters/InventoryItems"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter/InventoryItems/testItem"), - // Properties: &armconnectedvmware.ResourcePoolInventoryItem{ - // InventoryType: to.Ptr(armconnectedvmware.InventoryTypeResourcePool), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/machineextensions_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/machineextensions_client.go deleted file mode 100644 index 649c728d2115..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/machineextensions_client.go +++ /dev/null @@ -1,402 +0,0 @@ -//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" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// MachineExtensionsClient contains the methods for the MachineExtensions group. -// Don't use this type directly, use NewMachineExtensionsClient() instead. -type MachineExtensionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewMachineExtensionsClient creates a new instance of MachineExtensionsClient 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 NewMachineExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MachineExtensionsClient, error) { - cl, err := arm.NewClient(moduleName+".MachineExtensionsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MachineExtensionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// 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 -// - resourceGroupName - The Resource Group Name. -// - name - 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) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, name, extensionName, extensionParameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MachineExtensionsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[MachineExtensionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// 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) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// 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}" - 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 name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - if extensionName == "" { - return nil, errors.New("parameter extensionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{extensionName}", url.PathEscape(extensionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, extensionParameters) -} - -// 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 -// - resourceGroupName - The Resource Group Name. -// - name - 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) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, name, extensionName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[MachineExtensionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) - } else { - return runtime.NewPollerFromResumeToken[MachineExtensionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// 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) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// 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}" - 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 name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - if extensionName == "" { - return nil, errors.New("parameter extensionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{extensionName}", url.PathEscape(extensionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// 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 -// - resourceGroupName - The Resource Group Name. -// - name - 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) - if err != nil { - return MachineExtensionsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MachineExtensionsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MachineExtensionsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// 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}" - 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 name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - if extensionName == "" { - return nil, errors.New("parameter extensionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{extensionName}", url.PathEscape(extensionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *MachineExtensionsClient) getHandleResponse(resp *http.Response) (MachineExtensionsClientGetResponse, error) { - result := MachineExtensionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MachineExtension); err != nil { - return MachineExtensionsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - The operation to get all extensions of a non-Azure machine -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - name - The name of the machine containing the extension. -// - options - MachineExtensionsClientListOptions contains the optional parameters for the MachineExtensionsClient.NewListPager -// method. -func (client *MachineExtensionsClient) NewListPager(resourceGroupName string, name 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 - }, - Fetcher: func(ctx context.Context, page *MachineExtensionsClientListResponse) (MachineExtensionsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, name, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return MachineExtensionsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MachineExtensionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MachineExtensionsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// 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" - 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 name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - if options != nil && options.Expand != nil { - reqQP.Set("$expand", *options.Expand) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *MachineExtensionsClient) listHandleResponse(resp *http.Response) (MachineExtensionsClientListResponse, error) { - result := MachineExtensionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MachineExtensionsListResult); err != nil { - return MachineExtensionsClientListResponse{}, err - } - return result, nil -} - -// 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 -// - resourceGroupName - The Resource Group Name. -// - name - 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) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, name, extensionName, extensionParameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[MachineExtensionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) - } else { - return runtime.NewPollerFromResumeToken[MachineExtensionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// 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) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// 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}" - 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 name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - if extensionName == "" { - return nil, errors.New("parameter extensionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{extensionName}", url.PathEscape(extensionName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-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 2acadff22602..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/machineextensions_client_example_test.go +++ /dev/null @@ -1,289 +0,0 @@ -//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_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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMachineExtensionsClient().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]any{ - "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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MachineExtension = armconnectedvmware.MachineExtension{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/Extensions/CustomScriptExtension"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armconnectedvmware.MachineExtensionProperties{ - // Type: to.Ptr("string"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // InstanceView: &armconnectedvmware.MachineExtensionPropertiesInstanceView{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("CustomScriptExtension"), - // Status: &armconnectedvmware.MachineExtensionInstanceViewStatus{ - // Code: to.Ptr("success"), - // Level: to.Ptr(armconnectedvmware.StatusLevelTypes("Information")), - // Message: to.Ptr("Finished executing command, StdOut: , StdErr:"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-08T20:42:10.999Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: "@{commandToExecute=powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"}", - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMachineExtensionsClient().BeginUpdate(ctx, "myResourceGroup", "myMachine", "CustomScriptExtension", armconnectedvmware.MachineExtensionUpdate{ - Properties: &armconnectedvmware.MachineExtensionUpdateProperties{ - Type: to.Ptr("CustomScriptExtension"), - Publisher: to.Ptr("Microsoft.Compute"), - Settings: map[string]any{ - "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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MachineExtension = armconnectedvmware.MachineExtension{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/Extensions/CustomScriptExtension"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armconnectedvmware.MachineExtensionProperties{ - // Type: to.Ptr("string"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // InstanceView: &armconnectedvmware.MachineExtensionPropertiesInstanceView{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("CustomScriptExtension"), - // Status: &armconnectedvmware.MachineExtensionInstanceViewStatus{ - // Code: to.Ptr("success"), - // Level: to.Ptr(armconnectedvmware.StatusLevelTypes("Information")), - // Message: to.Ptr("Finished executing command, StdOut: , StdErr:"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-08T20:42:10.999Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: "@{commandToExecute=powershell.exe -c \"Get-Process | Where-Object { $_.CPU -lt 100 }\"}", - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMachineExtensionsClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMachineExtensionsClient().Get(ctx, "myResourceGroup", "myMachine", "CustomScriptExtension", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MachineExtension = armconnectedvmware.MachineExtension{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/Extensions/CustomScriptExtension"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armconnectedvmware.MachineExtensionProperties{ - // Type: to.Ptr("string"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // InstanceView: &armconnectedvmware.MachineExtensionPropertiesInstanceView{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("CustomScriptExtension"), - // Status: &armconnectedvmware.MachineExtensionInstanceViewStatus{ - // Code: to.Ptr("success"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armconnectedvmware.StatusLevelTypes("Information")), - // Message: to.Ptr("Finished executing command, StdOut: , StdErr:"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-08T20:42:10.999Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: "@{commandToExecute=powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"}", - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMachineExtensionsClient().NewListPager("myResourceGroup", "myMachine", &armconnectedvmware.MachineExtensionsClientListOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MachineExtensionsListResult = armconnectedvmware.MachineExtensionsListResult{ - // Value: []*armconnectedvmware.MachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/Extensions/CustomScriptExtension"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armconnectedvmware.MachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // InstanceView: &armconnectedvmware.MachineExtensionPropertiesInstanceView{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("CustomScriptExtension"), - // Status: &armconnectedvmware.MachineExtensionInstanceViewStatus{ - // Code: to.Ptr("success"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armconnectedvmware.StatusLevelTypes("Information")), - // Message: to.Ptr("formattedMessage: Finished executing command, StdOut: , StdErr: "), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-13T17:18:57.405Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // "commandToExecute": "powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"", - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // }, - // { - // Name: to.Ptr("winosupdateextension"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/Extensions/winosupdateextension"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armconnectedvmware.MachineExtensionProperties{ - // Type: to.Ptr("windowsosupdateextension"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // InstanceView: &armconnectedvmware.MachineExtensionPropertiesInstanceView{ - // Name: to.Ptr("winosupdateextension"), - // Type: to.Ptr("windowsosupdateextension"), - // Status: &armconnectedvmware.MachineExtensionInstanceViewStatus{ - // }, - // TypeHandlerVersion: to.Ptr("1.0.0.0"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("microsoft.softwareupdatemanagement.test"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.0.0.0"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/models.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/models.go index cf37092a3cbf..d46189e1b2d2 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/models.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/models.go @@ -13,42 +13,12 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware import "time" -// AvailablePatchCountByClassification - Summarization of patches available for installation on the machine by classification. -type AvailablePatchCountByClassification struct { - // READ-ONLY; Number of critical patches available for installation. - Critical *int32 - - // READ-ONLY; Number of definition patches available for installation. - Definition *int32 - - // READ-ONLY; Number of feature pack patches available for installation. - FeaturePack *int32 - - // READ-ONLY; Number of other patches available for installation. - Other *int32 - - // READ-ONLY; Number of security patches available for installation. - Security *int32 - - // READ-ONLY; Number of service pack patches available for installation. - ServicePack *int32 - - // READ-ONLY; Number of tools patches available for installation. - Tools *int32 - - // READ-ONLY; Number of update Rollup patches available for installation. - UpdateRollup *int32 - - // READ-ONLY; Number of updates category patches available for installation. - Updates *int32 -} - // Cluster - Define the cluster. type Cluster struct { // REQUIRED; Gets or sets the location. @@ -95,8 +65,8 @@ type ClusterInventoryItem struct { // Gets or sets the MoRef (Managed Object Reference) ID for the inventory item. MoRefID *string - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState } // GetInventoryItemProperties implements the InventoryItemPropertiesClassification interface for type ClusterInventoryItem. @@ -104,13 +74,13 @@ func (c *ClusterInventoryItem) GetInventoryItemProperties() *InventoryItemProper return &InventoryItemProperties{ InventoryType: c.InventoryType, ManagedResourceID: c.ManagedResourceID, - MoRefID: c.MoRefID, MoName: c.MoName, + MoRefID: c.MoRefID, ProvisioningState: c.ProvisioningState, } } -// 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 @@ -124,58 +94,35 @@ type ClusterProperties struct { // READ-ONLY; Gets the name of the corresponding resource in Kubernetes. CustomResourceName *string - // READ-ONLY; Gets or sets the datastore ARM ids. + // READ-ONLY; Gets the datastore ARM ids. DatastoreIDs []*string // READ-ONLY; Gets or sets the vCenter Managed Object name for the cluster. MoName *string - // READ-ONLY; Gets or sets the network ARM ids. + // READ-ONLY; Gets the network ARM ids. NetworkIDs []*string - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState // READ-ONLY; The resource status information. Statuses []*ResourceStatus - // READ-ONLY; Gets or sets a unique identifier for this resource. - UUID *string -} - -// ClustersClientBeginCreateOptions contains the optional parameters for the ClustersClient.BeginCreate method. -type ClustersClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. -type ClustersClientBeginDeleteOptions struct { - // Whether force delete was specified. - Force *bool - // Resumes the LRO from the provided token. - ResumeToken string -} + // READ-ONLY; Gets the max CPU usage across all cores on the cluster in MHz. + TotalCPUMHz *int64 -// ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. -type ClustersClientGetOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; Gets the total amount of physical memory on the cluster in GB. + TotalMemoryGB *int64 -// ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager -// method. -type ClustersClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; Gets or sets a unique identifier for this resource. + UUID *string -// ClustersClientListOptions contains the optional parameters for the ClustersClient.NewListPager method. -type ClustersClientListOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; Gets the used CPU usage across all cores on the cluster in MHz. + UsedCPUMHz *int64 -// ClustersClientUpdateOptions contains the optional parameters for the ClustersClient.Update method. -type ClustersClientUpdateOptions struct { - // placeholder for future optional parameters + // READ-ONLY; Gets the used physical memory on the cluster in GB. + UsedMemoryGB *int64 } // ClustersList - List of Clusters. @@ -239,8 +186,8 @@ type DatastoreInventoryItem struct { // Gets or sets the MoRef (Managed Object Reference) ID for the inventory item. MoRefID *string - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState } // GetInventoryItemProperties implements the InventoryItemPropertiesClassification interface for type DatastoreInventoryItem. @@ -248,13 +195,13 @@ func (d *DatastoreInventoryItem) GetInventoryItemProperties() *InventoryItemProp return &InventoryItemProperties{ InventoryType: d.InventoryType, ManagedResourceID: d.ManagedResourceID, - MoRefID: d.MoRefID, MoName: d.MoName, + MoRefID: d.MoRefID, ProvisioningState: d.ProvisioningState, } } -// 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 @@ -265,9 +212,15 @@ type DatastoreProperties struct { // Gets or sets the ARM Id of the vCenter resource in which this datastore resides. VCenterID *string + // READ-ONLY; Gets or sets Maximum capacity of this datastore in GBs. + CapacityGB *int64 + // READ-ONLY; Gets the name of the corresponding resource in Kubernetes. CustomResourceName *string + // READ-ONLY; Gets or sets Available space of this datastore in GBs. + FreeSpaceGB *int64 + // READ-ONLY; Gets or sets the vCenter Managed Object name for the datastore. MoName *string @@ -281,41 +234,6 @@ type DatastoreProperties struct { UUID *string } -// DatastoresClientBeginCreateOptions contains the optional parameters for the DatastoresClient.BeginCreate method. -type DatastoresClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatastoresClientBeginDeleteOptions contains the optional parameters for the DatastoresClient.BeginDelete method. -type DatastoresClientBeginDeleteOptions struct { - // Whether force delete was specified. - Force *bool - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatastoresClientGetOptions contains the optional parameters for the DatastoresClient.Get method. -type DatastoresClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatastoresClientListByResourceGroupOptions contains the optional parameters for the DatastoresClient.NewListByResourceGroupPager -// method. -type DatastoresClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// DatastoresClientListOptions contains the optional parameters for the DatastoresClient.NewListPager method. -type DatastoresClientListOptions struct { - // placeholder for future optional parameters -} - -// DatastoresClientUpdateOptions contains the optional parameters for the DatastoresClient.Update method. -type DatastoresClientUpdateOptions struct { - // placeholder for future optional parameters -} - // DatastoresList - List of Datastores. type DatastoresList struct { // REQUIRED; Array of Datastores @@ -325,21 +243,6 @@ type DatastoresList struct { NextLink *string } -// ErrorDetail - Error details. -type ErrorDetail struct { - // REQUIRED; The error's code. - Code *string - - // REQUIRED; A human readable error message. - Message *string - - // Additional error details. - Details []*ErrorDetail - - // Indicates which property in the request is responsible for the error. - Target *string -} - // ExtendedLocation - The extended location. type ExtendedLocation struct { // The extended location name. @@ -354,13 +257,13 @@ type GuestAgent struct { // REQUIRED; Resource properties. Properties *GuestAgentProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system data. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -376,25 +279,7 @@ type GuestAgentList struct { NextLink *string } -// GuestAgentProfile - Defines the resource properties. -type GuestAgentProfile struct { - // READ-ONLY; The hybrid machine agent full version. - AgentVersion *string - - // READ-ONLY; Details about the error state. - ErrorDetails []*ErrorDetail - - // READ-ONLY; The time of the last status change. - LastStatusChange *time.Time - - // READ-ONLY; The status of the hybrid machine agent. - Status *StatusTypes - - // READ-ONLY; Specifies the VM's unique SMBIOS ID. - VMUUID *string -} - -// GuestAgentProperties - Defines the resource properties. +// GuestAgentProperties - Describes the properties of a Virtual Machine Guest Agent. type GuestAgentProperties struct { // Username / Password Credentials to provision guest agent. Credentials *GuestCredential @@ -402,14 +287,17 @@ type GuestAgentProperties struct { // HTTP Proxy configuration for the VM. HTTPProxyConfig *HTTPProxyConfiguration + // The resource id of the private link scope this machine is assigned to, if any. + PrivateLinkScopeResourceID *string + // Gets or sets the guest agent provisioning action. ProvisioningAction *ProvisioningAction // READ-ONLY; Gets the name of the corresponding resource in Kubernetes. CustomResourceName *string - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState // READ-ONLY; Gets or sets the guest agent status. Status *string @@ -421,28 +309,6 @@ type GuestAgentProperties struct { UUID *string } -// GuestAgentsClientBeginCreateOptions contains the optional parameters for the GuestAgentsClient.BeginCreate method. -type GuestAgentsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GuestAgentsClientBeginDeleteOptions contains the optional parameters for the GuestAgentsClient.BeginDelete method. -type GuestAgentsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GuestAgentsClientGetOptions contains the optional parameters for the GuestAgentsClient.Get method. -type GuestAgentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// GuestAgentsClientListByVMOptions contains the optional parameters for the GuestAgentsClient.NewListByVMPager method. -type GuestAgentsClientListByVMOptions struct { - // placeholder for future optional parameters -} - // GuestCredential - Username / Password Credentials to connect to guest. type GuestCredential struct { // Gets or sets the password to connect with the guest. @@ -458,7 +324,7 @@ type HTTPProxyConfiguration struct { HTTPSProxy *string } -// 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 @@ -528,8 +394,8 @@ type HostInventoryItem struct { // Parent host inventory resource details. Parent *InventoryItemDetails - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState } // GetInventoryItemProperties implements the InventoryItemPropertiesClassification interface for type HostInventoryItem. @@ -537,13 +403,13 @@ func (h *HostInventoryItem) GetInventoryItemProperties() *InventoryItemPropertie return &InventoryItemProperties{ InventoryType: h.InventoryType, ManagedResourceID: h.ManagedResourceID, - MoRefID: h.MoRefID, MoName: h.MoName, + MoRefID: h.MoRefID, ProvisioningState: h.ProvisioningState, } } -// 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 @@ -554,14 +420,32 @@ type HostProperties struct { // Gets or sets the ARM Id of the vCenter resource in which this host resides. VCenterID *string + // READ-ONLY; Gets the max CPU usage across all cores in MHz. + CPUMhz *int64 + // READ-ONLY; Gets the name of the corresponding resource in Kubernetes. CustomResourceName *string + // READ-ONLY; Gets the datastore ARM ids. + DatastoreIDs []*string + + // READ-ONLY; Gets the total amount of physical memory on the host in GB. + MemorySizeGB *int64 + // READ-ONLY; Gets or sets the vCenter Managed Object name for the host. MoName *string - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the network ARM ids. + NetworkIDs []*string + + // READ-ONLY; Gets the used CPU usage across all cores in MHz. + OverallCPUUsageMHz *int64 + + // READ-ONLY; Gets the used physical memory on the host in GB. + OverallMemoryUsageGB *int64 + + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState // READ-ONLY; The resource status information. Statuses []*ResourceStatus @@ -570,41 +454,6 @@ type HostProperties struct { UUID *string } -// HostsClientBeginCreateOptions contains the optional parameters for the HostsClient.BeginCreate method. -type HostsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// HostsClientBeginDeleteOptions contains the optional parameters for the HostsClient.BeginDelete method. -type HostsClientBeginDeleteOptions struct { - // Whether force delete was specified. - Force *bool - // Resumes the LRO from the provided token. - ResumeToken string -} - -// HostsClientGetOptions contains the optional parameters for the HostsClient.Get method. -type HostsClientGetOptions struct { - // placeholder for future optional parameters -} - -// HostsClientListByResourceGroupOptions contains the optional parameters for the HostsClient.NewListByResourceGroupPager -// method. -type HostsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// HostsClientListOptions contains the optional parameters for the HostsClient.NewListPager method. -type HostsClientListOptions struct { - // placeholder for future optional parameters -} - -// HostsClientUpdateOptions contains the optional parameters for the HostsClient.Update method. -type HostsClientUpdateOptions struct { - // placeholder for future optional parameters -} - // HostsList - List of Hosts. type HostsList struct { // REQUIRED; Array of Hosts @@ -614,81 +463,37 @@ type HostsList struct { NextLink *string } -// HybridIdentityMetadata - Defines the HybridIdentityMetadata. -type HybridIdentityMetadata struct { - // REQUIRED; Resource properties. - Properties *HybridIdentityMetadataProperties - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The system data. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// HybridIdentityMetadataClientCreateOptions contains the optional parameters for the HybridIdentityMetadataClient.Create -// method. -type HybridIdentityMetadataClientCreateOptions struct { - // placeholder for future optional parameters -} - -// HybridIdentityMetadataClientDeleteOptions contains the optional parameters for the HybridIdentityMetadataClient.Delete -// method. -type HybridIdentityMetadataClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get method. -type HybridIdentityMetadataClientGetOptions struct { - // placeholder for future optional parameters -} - -// HybridIdentityMetadataClientListByVMOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListByVMPager -// method. -type HybridIdentityMetadataClientListByVMOptions struct { - // placeholder for future optional parameters -} +// InfrastructureProfile - Specifies the vCenter infrastructure specific settings for the virtual machine. +type InfrastructureProfile struct { + // Firmware type + FirmwareType *FirmwareType -// HybridIdentityMetadataList - List of HybridIdentityMetadata. -type HybridIdentityMetadataList struct { - // REQUIRED; Array of HybridIdentityMetadata - Value []*HybridIdentityMetadata + // Gets or sets the inventory Item ID for the virtual machine. + InventoryItemID *string - // Url to follow for getting next page of HybridIdentityMetadata. - NextLink *string -} + // Gets or sets the SMBIOS UUID of the vm. + SmbiosUUID *string -// HybridIdentityMetadataProperties - Defines the resource properties. -type HybridIdentityMetadataProperties struct { - // Gets or sets the Public Key. - PublicKey *string + // Gets or sets the ARM Id of the template resource to deploy the virtual machine. + TemplateID *string - // Gets or sets the Vm Id. - VMID *string + // Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. + VCenterID *string - // READ-ONLY; The identity of the resource. - Identity *Identity + // READ-ONLY; Gets the name of the corresponding resource in Kubernetes. + CustomResourceName *string - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string -} + // READ-ONLY; Gets or sets the folder path of the vm. + FolderPath *string -// Identity - Managed service identity. -type Identity struct { - // REQUIRED; The type of managed service identity. - Type *IdentityType + // READ-ONLY; Gets or sets the instance uuid of the vm. + InstanceUUID *string - // READ-ONLY; The principal id of managed service identity. - PrincipalID *string + // READ-ONLY; Gets or sets the vCenter Managed Object name for the virtual machine. + MoName *string - // READ-ONLY; The tenant of managed service identity. - TenantID *string + // READ-ONLY; Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine. + MoRefID *string } // InventoryItem - Defines the inventory item. @@ -701,39 +506,32 @@ type InventoryItem struct { // validate and persist this value. Kind *string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system data. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// 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 + // The inventory type. + InventoryType *InventoryType + // Gets or sets the vCenter Managed Object name for the resource. MoName *string } -// InventoryItemPropertiesClassification provides polymorphic access to related types. -// Call the interface's GetInventoryItemProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *ClusterInventoryItem, *DatastoreInventoryItem, *HostInventoryItem, *InventoryItemProperties, *ResourcePoolInventoryItem, -// - *VirtualMachineInventoryItem, *VirtualMachineTemplateInventoryItem, *VirtualNetworkInventoryItem -type InventoryItemPropertiesClassification interface { - // GetInventoryItemProperties returns the InventoryItemProperties content of the underlying type. - GetInventoryItemProperties() *InventoryItemProperties -} - -// InventoryItemProperties - Defines the resource properties. +// InventoryItemProperties - Describes the properties of an Inventory Item. type InventoryItemProperties struct { // REQUIRED; They inventory type. InventoryType *InventoryType @@ -747,34 +545,13 @@ type InventoryItemProperties struct { // Gets or sets the MoRef (Managed Object Reference) ID for the inventory item. MoRefID *string - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState } // GetInventoryItemProperties implements the InventoryItemPropertiesClassification interface for type InventoryItemProperties. func (i *InventoryItemProperties) GetInventoryItemProperties() *InventoryItemProperties { return i } -// InventoryItemsClientCreateOptions contains the optional parameters for the InventoryItemsClient.Create method. -type InventoryItemsClientCreateOptions struct { - // placeholder for future optional parameters -} - -// InventoryItemsClientDeleteOptions contains the optional parameters for the InventoryItemsClient.Delete method. -type InventoryItemsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// InventoryItemsClientGetOptions contains the optional parameters for the InventoryItemsClient.Get method. -type InventoryItemsClientGetOptions struct { - // placeholder for future optional parameters -} - -// InventoryItemsClientListByVCenterOptions contains the optional parameters for the InventoryItemsClient.NewListByVCenterPager -// method. -type InventoryItemsClientListByVCenterOptions struct { - // placeholder for future optional parameters -} - // InventoryItemsList - List of InventoryItems. type InventoryItemsList struct { // REQUIRED; Array of InventoryItems @@ -784,189 +561,6 @@ type InventoryItemsList struct { NextLink *string } -// LinuxParameters - Input for InstallPatches on a Linux VM, as directly received by the API -type LinuxParameters struct { - // The update classifications to select when installing patches for Linux. - ClassificationsToInclude []*VMGuestPatchClassificationLinux - - // packages to exclude in the patch operation. Format: packageName_packageVersion - PackageNameMasksToExclude []*string - - // packages to include in the patch operation. Format: packageName_packageVersion - PackageNameMasksToInclude []*string -} - -// MachineExtension - Describes a Machine Extension. -type MachineExtension struct { - // Gets or sets the location. - Location *string - - // Describes Machine Extension Properties. - Properties *MachineExtensionProperties - - // Gets or sets the Resource tags. - Tags map[string]*string - - // READ-ONLY; Gets or sets the Id. - ID *string - - // READ-ONLY; Gets or sets the name. - Name *string - - // READ-ONLY; The system data. - SystemData *SystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} - -// MachineExtensionInstanceViewStatus - Instance view status. -type MachineExtensionInstanceViewStatus struct { - // READ-ONLY; The status code. - Code *string - - // READ-ONLY; The short localizable label for the status. - DisplayStatus *string - - // READ-ONLY; The level code. - Level *StatusLevelTypes - - // READ-ONLY; The detailed status message, including for alerts and error messages. - Message *string - - // READ-ONLY; The time of the status. - Time *time.Time -} - -// MachineExtensionProperties - Describes the properties of a Machine Extension. -type MachineExtensionProperties struct { - // Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, - // however, the extension will not upgrade minor versions unless redeployed, even - // with this property set to true. - AutoUpgradeMinorVersion *bool - - // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. - EnableAutomaticUpgrade *bool - - // How the extension handler should be forced to update even if the extension configuration has not changed. - ForceUpdateTag *string - - // The machine extension instance view. - InstanceView *MachineExtensionPropertiesInstanceView - - // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - ProtectedSettings any - - // The name of the extension handler publisher. - Publisher *string - - // Json formatted public settings for the extension. - Settings any - - // Specifies the type of the extension; an example is "CustomScriptExtension". - Type *string - - // Specifies the version of the script handler. - TypeHandlerVersion *string - - // READ-ONLY; The provisioning state, which only appears in the response. - ProvisioningState *string -} - -// MachineExtensionPropertiesInstanceView - The machine extension instance view. -type MachineExtensionPropertiesInstanceView struct { - // Instance view status. - Status *MachineExtensionInstanceViewStatus - - // READ-ONLY; The machine extension name. - Name *string - - // READ-ONLY; Specifies the type of the extension; an example is "CustomScriptExtension". - Type *string - - // READ-ONLY; Specifies the version of the script handler. - TypeHandlerVersion *string -} - -// MachineExtensionUpdate - Describes a Machine Extension Update. -type MachineExtensionUpdate struct { - // Describes Machine Extension Update Properties. - Properties *MachineExtensionUpdateProperties - - // Resource tags. - Tags map[string]*string -} - -// MachineExtensionUpdateProperties - Describes the properties of a Machine Extension. -type MachineExtensionUpdateProperties struct { - // Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, - // however, the extension will not upgrade minor versions unless redeployed, even - // with this property set to true. - AutoUpgradeMinorVersion *bool - - // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. - EnableAutomaticUpgrade *bool - - // How the extension handler should be forced to update even if the extension configuration has not changed. - ForceUpdateTag *string - - // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - ProtectedSettings any - - // The name of the extension handler publisher. - Publisher *string - - // Json formatted public settings for the extension. - Settings any - - // Specifies the type of the extension; an example is "CustomScriptExtension". - Type *string - - // Specifies the version of the script handler. - TypeHandlerVersion *string -} - -// MachineExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginCreateOrUpdate -// method. -type MachineExtensionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MachineExtensionsClientBeginDeleteOptions contains the optional parameters for the MachineExtensionsClient.BeginDelete -// method. -type MachineExtensionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MachineExtensionsClientBeginUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginUpdate -// method. -type MachineExtensionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MachineExtensionsClientGetOptions contains the optional parameters for the MachineExtensionsClient.Get method. -type MachineExtensionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// MachineExtensionsClientListOptions contains the optional parameters for the MachineExtensionsClient.NewListPager method. -type MachineExtensionsClientListOptions struct { - // The expand expression to apply on the operation. - Expand *string -} - -// MachineExtensionsListResult - Describes the Machine Extensions List Result. -type MachineExtensionsListResult struct { - // The uri to fetch the next page of machine extensions. Call ListNext() with this to fetch the next page of extensions. - NextLink *string - - // The list of extensions - Value []*MachineExtension -} - // NetworkInterface - Network Interface model type NetworkInterface struct { // Gets or sets the device key value. @@ -1022,13 +616,13 @@ type NetworkInterfaceUpdate struct { PowerOnBoot *PowerOnBootOption } -// 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 } -// 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 @@ -1101,11 +695,6 @@ type OperationDisplay struct { Resource *string } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // OperationsList - Lists the operations available. type OperationsList struct { // REQUIRED; Array of operations @@ -1115,9 +704,9 @@ type OperationsList struct { NextLink *string } -// OsProfile - Defines the resource properties. -type OsProfile struct { - // Gets or sets administrator password. +// OsProfileForVMInstance - Specifies the operating system settings for the virtual machine. +type OsProfileForVMInstance struct { + // Sets administrator password. AdminPassword *string // Gets or sets administrator username. @@ -1129,20 +718,11 @@ type OsProfile struct { // Gets or sets the guestId. GuestID *string - // Specifies the linux configuration for update management. - LinuxConfiguration *OsProfileLinuxConfiguration - // Gets or sets the type of the os. OSType *OsType - // Specifies the windows configuration for update management. - WindowsConfiguration *OsProfileWindowsConfiguration - - // READ-ONLY; Gets or sets a value indicating whether the VM is ready for extension operations. - AllowExtensionOperations *bool - - // READ-ONLY; Gets or sets os name. - OSName *string + // READ-ONLY; Gets or sets os sku. + OSSKU *string // READ-ONLY; Gets or sets the current running status of VMware Tools running in the guest operating system. ToolsRunningStatus *string @@ -1154,49 +734,7 @@ type OsProfile struct { ToolsVersionStatus *string } -// OsProfileLinuxConfiguration - Specifies the linux configuration for update management. -type OsProfileLinuxConfiguration struct { - // Specifies the patch settings. - PatchSettings *PatchSettings -} - -// OsProfileUpdate - Defines the os update properties. -type OsProfileUpdate struct { - // Specifies the linux configuration for update management. - LinuxConfiguration *OsProfileUpdateLinuxConfiguration - - // Specifies the windows configuration for update management. - WindowsConfiguration *OsProfileUpdateWindowsConfiguration -} - -// OsProfileUpdateLinuxConfiguration - Specifies the linux configuration for update management. -type OsProfileUpdateLinuxConfiguration struct { - // Specifies the patch settings. - PatchSettings *PatchSettings -} - -// OsProfileUpdateWindowsConfiguration - Specifies the windows configuration for update management. -type OsProfileUpdateWindowsConfiguration struct { - // Specifies the patch settings. - PatchSettings *PatchSettings -} - -// OsProfileWindowsConfiguration - Specifies the windows configuration for update management. -type OsProfileWindowsConfiguration struct { - // Specifies the patch settings. - PatchSettings *PatchSettings -} - -// PatchSettings - Specifies the patch settings. -type PatchSettings struct { - // Specifies the assessment mode. - AssessmentMode *string - - // Specifies the patch mode. - PatchMode *string -} - -// 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 @@ -1266,8 +804,8 @@ type ResourcePoolInventoryItem struct { // Parent resourcePool inventory resource details. Parent *InventoryItemDetails - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState } // GetInventoryItemProperties implements the InventoryItemPropertiesClassification interface for type ResourcePoolInventoryItem. @@ -1275,13 +813,13 @@ func (r *ResourcePoolInventoryItem) GetInventoryItemProperties() *InventoryItemP return &InventoryItemProperties{ InventoryType: r.InventoryType, ManagedResourceID: r.ManagedResourceID, - MoRefID: r.MoRefID, MoName: r.MoName, + MoRefID: r.MoRefID, ProvisioningState: r.ProvisioningState, } } -// 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 @@ -1292,10 +830,16 @@ type ResourcePoolProperties struct { // Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. VCenterID *string + // READ-ONLY; Gets the max CPU usage across all cores on the pool in MHz. + CPUCapacityMHz *int64 + // READ-ONLY; Gets or sets CPULimitMHz which specifies a CPU usage limit in MHz. Utilization will not exceed this limit even // if there are available resources. CPULimitMHz *int64 + // READ-ONLY; Gets the used CPU usage across all cores on the pool in MHz. + CPUOverallUsageMHz *int64 + // READ-ONLY; Gets or sets CPUReservationMHz which specifies the CPU size in MHz that is guaranteed to be available. CPUReservationMHz *int64 @@ -1306,10 +850,19 @@ type ResourcePoolProperties struct { // READ-ONLY; Gets the name of the corresponding resource in Kubernetes. CustomResourceName *string + // READ-ONLY; Gets the datastore ARM ids. + DatastoreIDs []*string + + // READ-ONLY; Gets the total amount of physical memory on the pool in GB. + MemCapacityGB *int64 + // 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 + // READ-ONLY; Gets the used physical memory on the pool in GB. + MemOverallUsageGB *int64 + // READ-ONLY; Gets or sets MemReservationMB which specifies the guaranteed available memory in megabytes. MemReservationMB *int64 @@ -1320,8 +873,11 @@ type ResourcePoolProperties struct { // READ-ONLY; Gets or sets the vCenter Managed Object name for the resource pool. MoName *string - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the network ARM ids. + NetworkIDs []*string + + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState // READ-ONLY; The resource status information. Statuses []*ResourceStatus @@ -1330,41 +886,6 @@ type ResourcePoolProperties struct { UUID *string } -// ResourcePoolsClientBeginCreateOptions contains the optional parameters for the ResourcePoolsClient.BeginCreate method. -type ResourcePoolsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ResourcePoolsClientBeginDeleteOptions contains the optional parameters for the ResourcePoolsClient.BeginDelete method. -type ResourcePoolsClientBeginDeleteOptions struct { - // Whether force delete was specified. - Force *bool - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ResourcePoolsClientGetOptions contains the optional parameters for the ResourcePoolsClient.Get method. -type ResourcePoolsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ResourcePoolsClientListByResourceGroupOptions contains the optional parameters for the ResourcePoolsClient.NewListByResourceGroupPager -// method. -type ResourcePoolsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ResourcePoolsClientListOptions contains the optional parameters for the ResourcePoolsClient.NewListPager method. -type ResourcePoolsClientListOptions struct { - // placeholder for future optional parameters -} - -// ResourcePoolsClientUpdateOptions contains the optional parameters for the ResourcePoolsClient.Update method. -type ResourcePoolsClientUpdateOptions struct { - // placeholder for future optional parameters -} - // ResourcePoolsList - List of ResourcePools. type ResourcePoolsList struct { // REQUIRED; Array of ResourcePools @@ -1408,7 +929,7 @@ type StopVirtualMachineOptions struct { SkipShutdown *bool } -// 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 @@ -1417,7 +938,7 @@ type StorageProfile struct { ScsiControllers []*VirtualSCSIController } -// 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 @@ -1482,7 +1003,7 @@ type VCenter struct { Type *string } -// 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 @@ -1502,8 +1023,8 @@ type VCenterProperties struct { // READ-ONLY; Gets or sets the instance UUID of the vCenter. InstanceUUID *string - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState // READ-ONLY; The resource status information. Statuses []*ResourceStatus @@ -1515,41 +1036,6 @@ type VCenterProperties struct { Version *string } -// VCentersClientBeginCreateOptions contains the optional parameters for the VCentersClient.BeginCreate method. -type VCentersClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VCentersClientBeginDeleteOptions contains the optional parameters for the VCentersClient.BeginDelete method. -type VCentersClientBeginDeleteOptions struct { - // Whether force delete was specified. - Force *bool - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VCentersClientGetOptions contains the optional parameters for the VCentersClient.Get method. -type VCentersClientGetOptions struct { - // placeholder for future optional parameters -} - -// VCentersClientListByResourceGroupOptions contains the optional parameters for the VCentersClient.NewListByResourceGroupPager -// method. -type VCentersClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// VCentersClientListOptions contains the optional parameters for the VCentersClient.NewListPager method. -type VCentersClientListOptions struct { - // placeholder for future optional parameters -} - -// VCentersClientUpdateOptions contains the optional parameters for the VCentersClient.Update method. -type VCentersClientUpdateOptions struct { - // placeholder for future optional parameters -} - // VCentersList - List of VCenters. type VCentersList struct { // REQUIRED; Array of VCenters @@ -1568,6 +1054,45 @@ type VICredential struct { Username *string } +// VMInstanceHybridIdentityMetadata - Defines the HybridIdentityMetadata. +type VMInstanceHybridIdentityMetadata struct { + // REQUIRED; Resource properties. + Properties *VMInstanceHybridIdentityMetadataProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// VMInstanceHybridIdentityMetadataList - List of HybridIdentityMetadata. +type VMInstanceHybridIdentityMetadataList struct { + // REQUIRED; Array of HybridIdentityMetadata + Value []*VMInstanceHybridIdentityMetadata + + // Url to follow for getting next page of HybridIdentityMetadata. + NextLink *string +} + +// VMInstanceHybridIdentityMetadataProperties - Describes the properties of Hybrid Identity Metadata for a Virtual Machine. +type VMInstanceHybridIdentityMetadataProperties struct { + // Gets or sets the Public Key. + PublicKey *string + + // The unique identifier for the resource. + ResourceUID *string + + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState +} + // VirtualDisk - Virtual disk model type VirtualDisk struct { // Gets or sets the controller id. @@ -1628,141 +1153,88 @@ type VirtualDiskUpdate struct { UnitNumber *int32 } -// VirtualMachine - Define the virtualMachine. -type VirtualMachine struct { - // REQUIRED; Gets or sets the location. - Location *string - +// VirtualMachineInstance - Define the virtualMachineInstance. +type VirtualMachineInstance struct { // REQUIRED; Resource properties. - Properties *VirtualMachineProperties + Properties *VirtualMachineInstanceProperties // Gets or sets the extended location. ExtendedLocation *ExtendedLocation - // The identity of the resource. - Identity *Identity - - // Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are - // a kind of Microsoft.Web/sites type. If supported, the resource provider must - // validate and persist this value. - Kind *string - - // Gets or sets the Resource tags. - Tags map[string]*string - - // READ-ONLY; Gets or sets the Id. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Gets or sets the name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system data. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Gets or sets the type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// VirtualMachineAssessPatchesResult - Describes the properties of an AssessPatches result. -type VirtualMachineAssessPatchesResult struct { - // Summarization of patches available for installation on the machine by classification. - AvailablePatchCountByClassification *AvailablePatchCountByClassification - - // READ-ONLY; The activity ID of the operation that produced this result. - AssessmentActivityID *string - - // READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. - ErrorDetails *ErrorDetail - - // READ-ONLY; The UTC timestamp when the operation finished. - LastModifiedDateTime *time.Time +// VirtualMachineInstanceProperties - Describes the properties of a Virtual Machine Instance. +type VirtualMachineInstanceProperties struct { + // Hardware properties. + HardwareProfile *HardwareProfile - // READ-ONLY; The operating system type of the machine. - OSType *OsTypeUM + // Gets the infrastructure profile. + InfrastructureProfile *InfrastructureProfile - // READ-ONLY; Specifies the patch service used for the operation. - PatchServiceUsed *PatchServiceUsed + // Network properties. + NetworkProfile *NetworkProfile - // READ-ONLY; The overall reboot status of the VM. It will be true when partially installed patches require a reboot to complete - // installation but the reboot has not yet occurred. - RebootPending *bool + // OS properties. + OSProfile *OsProfileForVMInstance - // READ-ONLY; The UTC timestamp when the operation began. - StartDateTime *time.Time + // Placement properties. + PlacementProfile *PlacementProfile - // READ-ONLY; Indicates if operation was triggered by user or by platform. - StartedBy *PatchOperationStartedBy + // Gets the security profile. + SecurityProfile *SecurityProfile - // READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes. - // At that point it will become "Unknown", "Failed", "Succeeded", or - // "CompletedWithWarnings." - Status *PatchOperationStatus -} + // Storage properties. + StorageProfile *StorageProfile -// VirtualMachineInstallPatchesParameters - Input for InstallPatches as directly received by the API -type VirtualMachineInstallPatchesParameters struct { - // REQUIRED; Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string - // such as PT4H (4 hours) - MaximumDuration *string + // READ-ONLY; Gets the power state of the virtual machine. + PowerState *string - // REQUIRED; Defines when it is acceptable to reboot a VM during a software update operation. - RebootSetting *VMGuestPatchRebootSetting + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState - // Input for InstallPatches on a Linux VM, as directly received by the API - LinuxParameters *LinuxParameters + // READ-ONLY; Gets or sets a unique identifier for the vm resource. + ResourceUID *string - // Input for InstallPatches on a Windows VM, as directly received by the API - WindowsParameters *WindowsParameters + // READ-ONLY; The resource status information. + Statuses []*ResourceStatus } -// VirtualMachineInstallPatchesResult - The result summary of an installation operation. -type VirtualMachineInstallPatchesResult struct { - // READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. - ErrorDetails *ErrorDetail - - // READ-ONLY; The number of patches that were not installed due to the user blocking their installation. - ExcludedPatchCount *int32 - - // READ-ONLY; The number of patches that could not be installed due to some issue. See errors for details. - FailedPatchCount *int32 - - // READ-ONLY; The activity ID of the operation that produced this result. - InstallationActivityID *string - - // READ-ONLY; The number of patches successfully installed. - InstalledPatchCount *int32 - - // READ-ONLY; The UTC timestamp when the operation finished. - LastModifiedDateTime *time.Time - - // READ-ONLY; Whether the operation ran out of time before it completed all its intended actions. - MaintenanceWindowExceeded *bool - - // READ-ONLY; The number of patches that were detected as available for install, but did not meet the operation's criteria. - NotSelectedPatchCount *int32 - - // READ-ONLY; The operating system type of the machine. - OSType *OsTypeUM - - // READ-ONLY; Specifies the patch service used for the operation. - PatchServiceUsed *PatchServiceUsed +// VirtualMachineInstanceUpdate - Defines the virtualMachineInstanceUpdate. +type VirtualMachineInstanceUpdate struct { + // Resource properties. + Properties *VirtualMachineInstanceUpdateProperties +} - // READ-ONLY; The number of patches that were identified as meeting the installation criteria, but were not able to be installed. - // Typically this happens when maintenanceWindowExceeded == true. - PendingPatchCount *int32 +// VirtualMachineInstanceUpdateProperties - Describes the properties of a Virtual Machine. +type VirtualMachineInstanceUpdateProperties struct { + // Specifies the hardware settings for the virtual machine. + HardwareProfile *HardwareProfile - // READ-ONLY; The reboot state of the VM following completion of the operation. - RebootStatus *VMGuestPatchRebootStatus + // Specifies the network interfaces of the virtual machine. + NetworkProfile *NetworkProfileUpdate - // READ-ONLY; The UTC timestamp when the operation began. - StartDateTime *time.Time + // Specifies the storage settings for the virtual machine disks. + StorageProfile *StorageProfileUpdate +} - // READ-ONLY; Indicates if operation was triggered by user or by platform. - StartedBy *PatchOperationStartedBy +// VirtualMachineInstancesList - List of VirtualMachineInstances. +type VirtualMachineInstancesList struct { + // REQUIRED; Array of VirtualMachines + Value []*VirtualMachineInstance - // READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes. - // At that point it will become "Failed", "Succeeded", "Unknown" or "CompletedWithWarnings." - Status *PatchOperationStatus + // Url to follow for getting next page of VirtualMachines. + NextLink *string } // VirtualMachineInventoryItem - The VM inventory item. @@ -1770,6 +1242,9 @@ type VirtualMachineInventoryItem struct { // REQUIRED; They inventory type. InventoryType *InventoryType + // Cluster inventory resource details. + Cluster *InventoryItemDetails + // Gets or sets the folder path of the vm. FolderPath *string @@ -1806,8 +1281,8 @@ type VirtualMachineInventoryItem struct { // READ-ONLY; Gets the power state of the virtual machine. PowerState *string - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState // READ-ONLY; Gets or sets the current running status of VMware Tools running in the guest operating system. ToolsRunningStatus *string @@ -1824,84 +1299,12 @@ func (v *VirtualMachineInventoryItem) GetInventoryItemProperties() *InventoryIte return &InventoryItemProperties{ InventoryType: v.InventoryType, ManagedResourceID: v.ManagedResourceID, - MoRefID: v.MoRefID, MoName: v.MoName, + MoRefID: v.MoRefID, ProvisioningState: v.ProvisioningState, } } -// VirtualMachineProperties - Defines the resource properties. -type VirtualMachineProperties struct { - // Firmware type - FirmwareType *FirmwareType - - // Guest agent status properties. - GuestAgentProfile *GuestAgentProfile - - // Hardware properties. - HardwareProfile *HardwareProfile - - // Gets or sets the inventory Item ID for the virtual machine. - InventoryItemID *string - - // Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine. - MoRefID *string - - // Network properties. - NetworkProfile *NetworkProfile - - // OS properties. - OSProfile *OsProfile - - // Placement properties. - PlacementProfile *PlacementProfile - - // Gets or sets the ARM Id of the resourcePool resource on which this virtual machine will deploy. - ResourcePoolID *string - - // Gets the security profile. - SecurityProfile *SecurityProfile - - // Gets or sets the SMBIOS UUID of the vm. - SmbiosUUID *string - - // Storage properties. - StorageProfile *StorageProfile - - // Gets or sets the ARM Id of the template resource to deploy the virtual machine. - TemplateID *string - - // Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. - VCenterID *string - - // READ-ONLY; Gets the name of the corresponding resource in Kubernetes. - CustomResourceName *string - - // READ-ONLY; Gets or sets the folder path of the vm. - FolderPath *string - - // READ-ONLY; Gets or sets the instance uuid of the vm. - InstanceUUID *string - - // READ-ONLY; Gets or sets the vCenter Managed Object name for the virtual machine. - MoName *string - - // READ-ONLY; Gets the power state of the virtual machine. - PowerState *string - - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string - - // READ-ONLY; The resource status information. - Statuses []*ResourceStatus - - // READ-ONLY; Gets or sets a unique identifier for this resource. - UUID *string - - // READ-ONLY; Gets or sets a unique identifier for the vm resource. - VMID *string -} - // VirtualMachineTemplate - Define the virtualMachineTemplate. type VirtualMachineTemplate struct { // REQUIRED; Gets or sets the location. @@ -1966,8 +1369,14 @@ type VirtualMachineTemplateInventoryItem struct { // Gets or sets the type of the os. OSType *OsType - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets or sets the current version of VMware Tools. + ToolsVersion *string + + // READ-ONLY; Gets or sets the current version status of VMware Tools installed in the guest operating system. + ToolsVersionStatus *string } // GetInventoryItemProperties implements the InventoryItemPropertiesClassification interface for type VirtualMachineTemplateInventoryItem. @@ -1975,13 +1384,13 @@ func (v *VirtualMachineTemplateInventoryItem) GetInventoryItemProperties() *Inve return &InventoryItemProperties{ InventoryType: v.InventoryType, ManagedResourceID: v.ManagedResourceID, - MoRefID: v.MoRefID, MoName: v.MoName, + MoRefID: v.MoRefID, ProvisioningState: v.ProvisioningState, } } -// 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 @@ -2025,8 +1434,8 @@ type VirtualMachineTemplateProperties struct { // READ-ONLY; Gets or sets the type of the os. OSType *OsType - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState // READ-ONLY; The resource status information. Statuses []*ResourceStatus @@ -2041,45 +1450,6 @@ type VirtualMachineTemplateProperties struct { UUID *string } -// VirtualMachineTemplatesClientBeginCreateOptions contains the optional parameters for the VirtualMachineTemplatesClient.BeginCreate -// method. -type VirtualMachineTemplatesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachineTemplatesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineTemplatesClient.BeginDelete -// method. -type VirtualMachineTemplatesClientBeginDeleteOptions struct { - // Whether force delete was specified. - Force *bool - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachineTemplatesClientGetOptions contains the optional parameters for the VirtualMachineTemplatesClient.Get method. -type VirtualMachineTemplatesClientGetOptions struct { - // placeholder for future optional parameters -} - -// VirtualMachineTemplatesClientListByResourceGroupOptions contains the optional parameters for the VirtualMachineTemplatesClient.NewListByResourceGroupPager -// method. -type VirtualMachineTemplatesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// VirtualMachineTemplatesClientListOptions contains the optional parameters for the VirtualMachineTemplatesClient.NewListPager -// method. -type VirtualMachineTemplatesClientListOptions struct { - // placeholder for future optional parameters -} - -// VirtualMachineTemplatesClientUpdateOptions contains the optional parameters for the VirtualMachineTemplatesClient.Update -// method. -type VirtualMachineTemplatesClientUpdateOptions struct { - // placeholder for future optional parameters -} - // VirtualMachineTemplatesList - List of VirtualMachineTemplates. type VirtualMachineTemplatesList struct { // REQUIRED; Array of VirtualMachineTemplates @@ -2089,114 +1459,6 @@ type VirtualMachineTemplatesList struct { NextLink *string } -// VirtualMachineUpdate - Defines the virtualMachineUpdate. -type VirtualMachineUpdate struct { - // The identity of the resource. - Identity *Identity - - // Resource properties. - Properties *VirtualMachineUpdateProperties - - // Gets or sets the Resource tags. - Tags map[string]*string -} - -// VirtualMachineUpdateProperties - Defines the resource properties. -type VirtualMachineUpdateProperties struct { - // Defines the resource properties. - HardwareProfile *HardwareProfile - - // Defines the update resource properties. - NetworkProfile *NetworkProfileUpdate - - // OS properties. - OSProfile *OsProfileUpdate - - // Defines the resource update properties. - StorageProfile *StorageProfileUpdate -} - -// VirtualMachinesClientBeginAssessPatchesOptions contains the optional parameters for the VirtualMachinesClient.BeginAssessPatches -// method. -type VirtualMachinesClientBeginAssessPatchesOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachinesClientBeginCreateOptions contains the optional parameters for the VirtualMachinesClient.BeginCreate method. -type VirtualMachinesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachinesClientBeginDeleteOptions contains the optional parameters for the VirtualMachinesClient.BeginDelete method. -type VirtualMachinesClientBeginDeleteOptions struct { - // Whether force delete was specified. - Force *bool - // Resumes the LRO from the provided token. - ResumeToken string - // Whether to just disable the VM from azure and retain the VM in the VMM. - Retain *bool -} - -// VirtualMachinesClientBeginInstallPatchesOptions contains the optional parameters for the VirtualMachinesClient.BeginInstallPatches -// method. -type VirtualMachinesClientBeginInstallPatchesOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachinesClientBeginRestartOptions contains the optional parameters for the VirtualMachinesClient.BeginRestart method. -type VirtualMachinesClientBeginRestartOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachinesClientBeginStartOptions contains the optional parameters for the VirtualMachinesClient.BeginStart method. -type VirtualMachinesClientBeginStartOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachinesClientBeginStopOptions contains the optional parameters for the VirtualMachinesClient.BeginStop method. -type VirtualMachinesClientBeginStopOptions struct { - // Virtualmachine stop action payload. - Body *StopVirtualMachineOptions - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachinesClientBeginUpdateOptions contains the optional parameters for the VirtualMachinesClient.BeginUpdate method. -type VirtualMachinesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachinesClientGetOptions contains the optional parameters for the VirtualMachinesClient.Get method. -type VirtualMachinesClientGetOptions struct { - // placeholder for future optional parameters -} - -// VirtualMachinesClientListByResourceGroupOptions contains the optional parameters for the VirtualMachinesClient.NewListByResourceGroupPager -// method. -type VirtualMachinesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// VirtualMachinesClientListOptions contains the optional parameters for the VirtualMachinesClient.NewListPager method. -type VirtualMachinesClientListOptions struct { - // placeholder for future optional parameters -} - -// VirtualMachinesList - List of VirtualMachines. -type VirtualMachinesList struct { - // REQUIRED; Array of VirtualMachines - Value []*VirtualMachine - - // Url to follow for getting next page of VirtualMachines. - NextLink *string -} - // VirtualNetwork - Define the virtualNetwork. type VirtualNetwork struct { // REQUIRED; Gets or sets the location. @@ -2243,8 +1505,8 @@ type VirtualNetworkInventoryItem struct { // Gets or sets the MoRef (Managed Object Reference) ID for the inventory item. MoRefID *string - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState } // GetInventoryItemProperties implements the InventoryItemPropertiesClassification interface for type VirtualNetworkInventoryItem. @@ -2252,13 +1514,13 @@ func (v *VirtualNetworkInventoryItem) GetInventoryItemProperties() *InventoryIte return &InventoryItemProperties{ InventoryType: v.InventoryType, ManagedResourceID: v.ManagedResourceID, - MoRefID: v.MoRefID, MoName: v.MoName, + MoRefID: v.MoRefID, ProvisioningState: v.ProvisioningState, } } -// 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 @@ -2275,8 +1537,8 @@ type VirtualNetworkProperties struct { // READ-ONLY; Gets or sets the vCenter Managed Object name for the virtual network. MoName *string - // READ-ONLY; Gets or sets the provisioning state. - ProvisioningState *string + // READ-ONLY; Gets the provisioning state. + ProvisioningState *ProvisioningState // READ-ONLY; The resource status information. Statuses []*ResourceStatus @@ -2285,41 +1547,6 @@ type VirtualNetworkProperties struct { UUID *string } -// VirtualNetworksClientBeginCreateOptions contains the optional parameters for the VirtualNetworksClient.BeginCreate method. -type VirtualNetworksClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualNetworksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworksClient.BeginDelete method. -type VirtualNetworksClientBeginDeleteOptions struct { - // Whether force delete was specified. - Force *bool - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualNetworksClientGetOptions contains the optional parameters for the VirtualNetworksClient.Get method. -type VirtualNetworksClientGetOptions struct { - // placeholder for future optional parameters -} - -// VirtualNetworksClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworksClient.NewListByResourceGroupPager -// method. -type VirtualNetworksClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// VirtualNetworksClientListOptions contains the optional parameters for the VirtualNetworksClient.NewListPager method. -type VirtualNetworksClientListOptions struct { - // placeholder for future optional parameters -} - -// VirtualNetworksClientUpdateOptions contains the optional parameters for the VirtualNetworksClient.Update method. -type VirtualNetworksClientUpdateOptions struct { - // placeholder for future optional parameters -} - // VirtualNetworksList - List of VirtualNetworks. type VirtualNetworksList struct { // REQUIRED; Array of VirtualNetworks @@ -2347,21 +1574,3 @@ type VirtualSCSIController struct { // Gets or sets the controller type. Type *SCSIControllerType } - -// WindowsParameters - Input for InstallPatches on a Windows VM, as directly received by the API -type WindowsParameters struct { - // The update classifications to select when installing patches for Windows. - ClassificationsToInclude []*VMGuestPatchClassificationWindows - - // Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is set to true. - ExcludeKbsRequiringReboot *bool - - // Kbs to exclude in the patch operation - KbNumbersToExclude []*string - - // Kbs to include in the patch operation - KbNumbersToInclude []*string - - // This is used to install patches that were published on or before this given max published date. - MaxPatchPublishDate *time.Time -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/models_serde.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/models_serde.go index 3986c0f853dd..73c10a30d8d6 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/models_serde.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/models_serde.go @@ -13,7 +13,7 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware @@ -24,65 +24,6 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type AvailablePatchCountByClassification. -func (a AvailablePatchCountByClassification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "critical", a.Critical) - populate(objectMap, "definition", a.Definition) - populate(objectMap, "featurePack", a.FeaturePack) - populate(objectMap, "other", a.Other) - populate(objectMap, "security", a.Security) - populate(objectMap, "servicePack", a.ServicePack) - populate(objectMap, "tools", a.Tools) - populate(objectMap, "updateRollup", a.UpdateRollup) - populate(objectMap, "updates", a.Updates) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AvailablePatchCountByClassification. -func (a *AvailablePatchCountByClassification) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "critical": - err = unpopulate(val, "Critical", &a.Critical) - delete(rawMsg, key) - case "definition": - err = unpopulate(val, "Definition", &a.Definition) - delete(rawMsg, key) - case "featurePack": - err = unpopulate(val, "FeaturePack", &a.FeaturePack) - delete(rawMsg, key) - case "other": - err = unpopulate(val, "Other", &a.Other) - delete(rawMsg, key) - case "security": - err = unpopulate(val, "Security", &a.Security) - delete(rawMsg, key) - case "servicePack": - err = unpopulate(val, "ServicePack", &a.ServicePack) - delete(rawMsg, key) - case "tools": - err = unpopulate(val, "Tools", &a.Tools) - delete(rawMsg, key) - case "updateRollup": - err = unpopulate(val, "UpdateRollup", &a.UpdateRollup) - delete(rawMsg, key) - case "updates": - err = unpopulate(val, "Updates", &a.Updates) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type Cluster. func (c Cluster) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -196,7 +137,11 @@ func (c ClusterProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "networkIds", c.NetworkIDs) populate(objectMap, "provisioningState", c.ProvisioningState) populate(objectMap, "statuses", c.Statuses) + populate(objectMap, "totalCpuMHz", c.TotalCPUMHz) + populate(objectMap, "totalMemoryGB", c.TotalMemoryGB) populate(objectMap, "uuid", c.UUID) + populate(objectMap, "usedCpuMHz", c.UsedCPUMHz) + populate(objectMap, "usedMemoryGB", c.UsedMemoryGB) populate(objectMap, "vCenterId", c.VCenterID) return json.Marshal(objectMap) } @@ -234,9 +179,21 @@ func (c *ClusterProperties) UnmarshalJSON(data []byte) error { case "statuses": err = unpopulate(val, "Statuses", &c.Statuses) delete(rawMsg, key) + case "totalCpuMHz": + err = unpopulate(val, "TotalCPUMHz", &c.TotalCPUMHz) + delete(rawMsg, key) + case "totalMemoryGB": + err = unpopulate(val, "TotalMemoryGB", &c.TotalMemoryGB) + delete(rawMsg, key) case "uuid": err = unpopulate(val, "UUID", &c.UUID) delete(rawMsg, key) + case "usedCpuMHz": + err = unpopulate(val, "UsedCPUMHz", &c.UsedCPUMHz) + delete(rawMsg, key) + case "usedMemoryGB": + err = unpopulate(val, "UsedMemoryGB", &c.UsedMemoryGB) + delete(rawMsg, key) case "vCenterId": err = unpopulate(val, "VCenterID", &c.VCenterID) delete(rawMsg, key) @@ -392,7 +349,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]any) + 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) @@ -412,9 +371,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) @@ -475,45 +440,6 @@ func (d *DatastoresList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. func (e ExtendedLocation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -619,55 +545,13 @@ func (g *GuestAgentList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type GuestAgentProfile. -func (g GuestAgentProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "agentVersion", g.AgentVersion) - populate(objectMap, "errorDetails", g.ErrorDetails) - populateTimeRFC3339(objectMap, "lastStatusChange", g.LastStatusChange) - populate(objectMap, "status", g.Status) - populate(objectMap, "vmUuid", g.VMUUID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentProfile. -func (g *GuestAgentProfile) 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 "agentVersion": - err = unpopulate(val, "AgentVersion", &g.AgentVersion) - 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 "status": - err = unpopulate(val, "Status", &g.Status) - delete(rawMsg, key) - case "vmUuid": - err = unpopulate(val, "VMUUID", &g.VMUUID) - 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]any) populate(objectMap, "credentials", g.Credentials) populate(objectMap, "customResourceName", g.CustomResourceName) populate(objectMap, "httpProxyConfig", g.HTTPProxyConfig) + populate(objectMap, "privateLinkScopeResourceId", g.PrivateLinkScopeResourceID) populate(objectMap, "provisioningAction", g.ProvisioningAction) populate(objectMap, "provisioningState", g.ProvisioningState) populate(objectMap, "status", g.Status) @@ -694,6 +578,9 @@ func (g *GuestAgentProperties) UnmarshalJSON(data []byte) error { case "httpProxyConfig": err = unpopulate(val, "HTTPProxyConfig", &g.HTTPProxyConfig) delete(rawMsg, key) + case "privateLinkScopeResourceId": + err = unpopulate(val, "PrivateLinkScopeResourceID", &g.PrivateLinkScopeResourceID) + delete(rawMsg, key) case "provisioningAction": err = unpopulate(val, "ProvisioningAction", &g.ProvisioningAction) delete(rawMsg, key) @@ -931,10 +818,16 @@ func (h *HostInventoryItem) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HostProperties. func (h HostProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "cpuMhz", h.CPUMhz) populate(objectMap, "customResourceName", h.CustomResourceName) + populate(objectMap, "datastoreIds", h.DatastoreIDs) populate(objectMap, "inventoryItemId", h.InventoryItemID) + populate(objectMap, "memorySizeGB", h.MemorySizeGB) populate(objectMap, "moName", h.MoName) populate(objectMap, "moRefId", h.MoRefID) + populate(objectMap, "networkIds", h.NetworkIDs) + populate(objectMap, "overallCpuUsageMHz", h.OverallCPUUsageMHz) + populate(objectMap, "overallMemoryUsageGB", h.OverallMemoryUsageGB) populate(objectMap, "provisioningState", h.ProvisioningState) populate(objectMap, "statuses", h.Statuses) populate(objectMap, "uuid", h.UUID) @@ -951,18 +844,36 @@ func (h *HostProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "cpuMhz": + err = unpopulate(val, "CPUMhz", &h.CPUMhz) + delete(rawMsg, key) 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) + case "memorySizeGB": + err = unpopulate(val, "MemorySizeGB", &h.MemorySizeGB) + delete(rawMsg, key) case "moName": err = unpopulate(val, "MoName", &h.MoName) delete(rawMsg, key) case "moRefId": err = unpopulate(val, "MoRefID", &h.MoRefID) delete(rawMsg, key) + case "networkIds": + err = unpopulate(val, "NetworkIDs", &h.NetworkIDs) + delete(rawMsg, key) + case "overallCpuUsageMHz": + err = unpopulate(val, "OverallCPUUsageMHz", &h.OverallCPUUsageMHz) + delete(rawMsg, key) + case "overallMemoryUsageGB": + err = unpopulate(val, "OverallMemoryUsageGB", &h.OverallMemoryUsageGB) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) delete(rawMsg, key) @@ -1014,145 +925,60 @@ func (h *HostsList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadata. -func (h HybridIdentityMetadata) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InfrastructureProfile. +func (i InfrastructureProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", h.ID) - populate(objectMap, "name", h.Name) - populate(objectMap, "properties", h.Properties) - populate(objectMap, "systemData", h.SystemData) - populate(objectMap, "type", h.Type) + populate(objectMap, "customResourceName", i.CustomResourceName) + populate(objectMap, "firmwareType", i.FirmwareType) + populate(objectMap, "folderPath", i.FolderPath) + populate(objectMap, "instanceUuid", i.InstanceUUID) + populate(objectMap, "inventoryItemId", i.InventoryItemID) + populate(objectMap, "moName", i.MoName) + populate(objectMap, "moRefId", i.MoRefID) + populate(objectMap, "smbiosUuid", i.SmbiosUUID) + populate(objectMap, "templateId", i.TemplateID) + populate(objectMap, "vCenterId", i.VCenterID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadata. -func (h *HybridIdentityMetadata) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InfrastructureProfile. +func (i *InfrastructureProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &h.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &h.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &h.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &h.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &h.Type) + case "customResourceName": + err = unpopulate(val, "CustomResourceName", &i.CustomResourceName) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataList. -func (h HybridIdentityMetadataList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", h.NextLink) - populate(objectMap, "value", h.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataList. -func (h *HybridIdentityMetadataList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &h.NextLink) + case "firmwareType": + err = unpopulate(val, "FirmwareType", &i.FirmwareType) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &h.Value) + case "folderPath": + err = unpopulate(val, "FolderPath", &i.FolderPath) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataProperties. -func (h HybridIdentityMetadataProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "identity", h.Identity) - populate(objectMap, "provisioningState", h.ProvisioningState) - populate(objectMap, "publicKey", h.PublicKey) - populate(objectMap, "vmId", h.VMID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataProperties. -func (h *HybridIdentityMetadataProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "identity": - err = unpopulate(val, "Identity", &h.Identity) + case "instanceUuid": + err = unpopulate(val, "InstanceUUID", &i.InstanceUUID) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + case "inventoryItemId": + err = unpopulate(val, "InventoryItemID", &i.InventoryItemID) delete(rawMsg, key) - case "publicKey": - err = unpopulate(val, "PublicKey", &h.PublicKey) + case "moName": + err = unpopulate(val, "MoName", &i.MoName) delete(rawMsg, key) - case "vmId": - err = unpopulate(val, "VMID", &h.VMID) + case "moRefId": + err = unpopulate(val, "MoRefID", &i.MoRefID) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. -func (i *Identity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &i.PrincipalID) + case "smbiosUuid": + err = unpopulate(val, "SmbiosUUID", &i.SmbiosUUID) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &i.TenantID) + case "templateId": + err = unpopulate(val, "TemplateID", &i.TemplateID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "vCenterId": + err = unpopulate(val, "VCenterID", &i.VCenterID) delete(rawMsg, key) } if err != nil { @@ -1213,6 +1039,7 @@ func (i *InventoryItem) UnmarshalJSON(data []byte) error { func (i InventoryItemDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "inventoryItemId", i.InventoryItemID) + populate(objectMap, "inventoryType", i.InventoryType) populate(objectMap, "moName", i.MoName) return json.Marshal(objectMap) } @@ -1229,6 +1056,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) @@ -1314,416 +1144,68 @@ func (i *InventoryItemsList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type LinuxParameters. -func (l LinuxParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkInterface. +func (n NetworkInterface) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "classificationsToInclude", l.ClassificationsToInclude) - populate(objectMap, "packageNameMasksToExclude", l.PackageNameMasksToExclude) - populate(objectMap, "packageNameMasksToInclude", l.PackageNameMasksToInclude) + populate(objectMap, "deviceKey", n.DeviceKey) + populate(objectMap, "ipAddresses", n.IPAddresses) + populate(objectMap, "ipSettings", n.IPSettings) + populate(objectMap, "label", n.Label) + populate(objectMap, "macAddress", n.MacAddress) + populate(objectMap, "name", n.Name) + populate(objectMap, "networkId", n.NetworkID) + populate(objectMap, "networkMoName", n.NetworkMoName) + populate(objectMap, "networkMoRefId", n.NetworkMoRefID) + populate(objectMap, "nicType", n.NicType) + populate(objectMap, "powerOnBoot", n.PowerOnBoot) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxParameters. -func (l *LinuxParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterface. +func (n *NetworkInterface) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "classificationsToInclude": - err = unpopulate(val, "ClassificationsToInclude", &l.ClassificationsToInclude) + case "deviceKey": + err = unpopulate(val, "DeviceKey", &n.DeviceKey) + delete(rawMsg, key) + case "ipAddresses": + err = unpopulate(val, "IPAddresses", &n.IPAddresses) + delete(rawMsg, key) + case "ipSettings": + err = unpopulate(val, "IPSettings", &n.IPSettings) + delete(rawMsg, key) + case "label": + err = unpopulate(val, "Label", &n.Label) + delete(rawMsg, key) + case "macAddress": + err = unpopulate(val, "MacAddress", &n.MacAddress) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "networkId": + err = unpopulate(val, "NetworkID", &n.NetworkID) + delete(rawMsg, key) + case "networkMoName": + err = unpopulate(val, "NetworkMoName", &n.NetworkMoName) + delete(rawMsg, key) + case "networkMoRefId": + err = unpopulate(val, "NetworkMoRefID", &n.NetworkMoRefID) delete(rawMsg, key) - case "packageNameMasksToExclude": - err = unpopulate(val, "PackageNameMasksToExclude", &l.PackageNameMasksToExclude) + case "nicType": + err = unpopulate(val, "NicType", &n.NicType) delete(rawMsg, key) - case "packageNameMasksToInclude": - err = unpopulate(val, "PackageNameMasksToInclude", &l.PackageNameMasksToInclude) + case "powerOnBoot": + err = unpopulate(val, "PowerOnBoot", &n.PowerOnBoot) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MachineExtension. -func (m MachineExtension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", m.ID) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtension. -func (m *MachineExtension) 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 "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &m.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &m.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - 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]any) - populate(objectMap, "code", m.Code) - populate(objectMap, "displayStatus", m.DisplayStatus) - populate(objectMap, "level", m.Level) - populate(objectMap, "message", m.Message) - populateTimeRFC3339(objectMap, "time", m.Time) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionInstanceViewStatus. -func (m *MachineExtensionInstanceViewStatus) 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 "code": - err = unpopulate(val, "Code", &m.Code) - delete(rawMsg, key) - case "displayStatus": - err = unpopulate(val, "DisplayStatus", &m.DisplayStatus) - delete(rawMsg, key) - case "level": - err = unpopulate(val, "Level", &m.Level) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &m.Message) - delete(rawMsg, key) - case "time": - err = unpopulateTimeRFC3339(val, "Time", &m.Time) - 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 MachineExtensionProperties. -func (m MachineExtensionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "autoUpgradeMinorVersion", m.AutoUpgradeMinorVersion) - populate(objectMap, "enableAutomaticUpgrade", m.EnableAutomaticUpgrade) - populate(objectMap, "forceUpdateTag", m.ForceUpdateTag) - populate(objectMap, "instanceView", m.InstanceView) - populateAny(objectMap, "protectedSettings", m.ProtectedSettings) - populate(objectMap, "provisioningState", m.ProvisioningState) - populate(objectMap, "publisher", m.Publisher) - populateAny(objectMap, "settings", m.Settings) - populate(objectMap, "type", m.Type) - populate(objectMap, "typeHandlerVersion", m.TypeHandlerVersion) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionProperties. -func (m *MachineExtensionProperties) 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 "autoUpgradeMinorVersion": - err = unpopulate(val, "AutoUpgradeMinorVersion", &m.AutoUpgradeMinorVersion) - delete(rawMsg, key) - case "enableAutomaticUpgrade": - err = unpopulate(val, "EnableAutomaticUpgrade", &m.EnableAutomaticUpgrade) - delete(rawMsg, key) - case "forceUpdateTag": - err = unpopulate(val, "ForceUpdateTag", &m.ForceUpdateTag) - delete(rawMsg, key) - case "instanceView": - err = unpopulate(val, "InstanceView", &m.InstanceView) - delete(rawMsg, key) - case "protectedSettings": - err = unpopulate(val, "ProtectedSettings", &m.ProtectedSettings) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) - delete(rawMsg, key) - case "publisher": - err = unpopulate(val, "Publisher", &m.Publisher) - delete(rawMsg, key) - case "settings": - err = unpopulate(val, "Settings", &m.Settings) - 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 MachineExtensionPropertiesInstanceView. -func (m MachineExtensionPropertiesInstanceView) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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 MachineExtensionPropertiesInstanceView. -func (m *MachineExtensionPropertiesInstanceView) 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 MachineExtensionUpdate. -func (m MachineExtensionUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionUpdate. -func (m *MachineExtensionUpdate) 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 "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &m.Tags) - 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 MachineExtensionUpdateProperties. -func (m MachineExtensionUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "autoUpgradeMinorVersion", m.AutoUpgradeMinorVersion) - populate(objectMap, "enableAutomaticUpgrade", m.EnableAutomaticUpgrade) - populate(objectMap, "forceUpdateTag", m.ForceUpdateTag) - populateAny(objectMap, "protectedSettings", m.ProtectedSettings) - populate(objectMap, "publisher", m.Publisher) - populateAny(objectMap, "settings", m.Settings) - populate(objectMap, "type", m.Type) - populate(objectMap, "typeHandlerVersion", m.TypeHandlerVersion) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionUpdateProperties. -func (m *MachineExtensionUpdateProperties) 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 "autoUpgradeMinorVersion": - err = unpopulate(val, "AutoUpgradeMinorVersion", &m.AutoUpgradeMinorVersion) - delete(rawMsg, key) - case "enableAutomaticUpgrade": - err = unpopulate(val, "EnableAutomaticUpgrade", &m.EnableAutomaticUpgrade) - delete(rawMsg, key) - case "forceUpdateTag": - err = unpopulate(val, "ForceUpdateTag", &m.ForceUpdateTag) - delete(rawMsg, key) - case "protectedSettings": - err = unpopulate(val, "ProtectedSettings", &m.ProtectedSettings) - delete(rawMsg, key) - case "publisher": - err = unpopulate(val, "Publisher", &m.Publisher) - delete(rawMsg, key) - case "settings": - err = unpopulate(val, "Settings", &m.Settings) - 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 MachineExtensionsListResult. -func (m MachineExtensionsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", m.NextLink) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionsListResult. -func (m *MachineExtensionsListResult) 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 "nextLink": - err = unpopulate(val, "NextLink", &m.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &m.Value) - 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 NetworkInterface. -func (n NetworkInterface) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "deviceKey", n.DeviceKey) - populate(objectMap, "ipAddresses", n.IPAddresses) - populate(objectMap, "ipSettings", n.IPSettings) - populate(objectMap, "label", n.Label) - populate(objectMap, "macAddress", n.MacAddress) - populate(objectMap, "name", n.Name) - populate(objectMap, "networkId", n.NetworkID) - populate(objectMap, "networkMoName", n.NetworkMoName) - populate(objectMap, "networkMoRefId", n.NetworkMoRefID) - populate(objectMap, "nicType", n.NicType) - populate(objectMap, "powerOnBoot", n.PowerOnBoot) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterface. -func (n *NetworkInterface) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "deviceKey": - err = unpopulate(val, "DeviceKey", &n.DeviceKey) - delete(rawMsg, key) - case "ipAddresses": - err = unpopulate(val, "IPAddresses", &n.IPAddresses) - delete(rawMsg, key) - case "ipSettings": - err = unpopulate(val, "IPSettings", &n.IPSettings) - delete(rawMsg, key) - case "label": - err = unpopulate(val, "Label", &n.Label) - delete(rawMsg, key) - case "macAddress": - err = unpopulate(val, "MacAddress", &n.MacAddress) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &n.Name) - delete(rawMsg, key) - case "networkId": - err = unpopulate(val, "NetworkID", &n.NetworkID) - delete(rawMsg, key) - case "networkMoName": - err = unpopulate(val, "NetworkMoName", &n.NetworkMoName) - delete(rawMsg, key) - case "networkMoRefId": - err = unpopulate(val, "NetworkMoRefID", &n.NetworkMoRefID) - delete(rawMsg, key) - case "nicType": - err = unpopulate(val, "NicType", &n.NicType) - delete(rawMsg, key) - case "powerOnBoot": - err = unpopulate(val, "PowerOnBoot", &n.PowerOnBoot) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil @@ -1906,259 +1388,27 @@ func (n *NicIPSettings) UnmarshalJSON(data []byte) error { err = unpopulate(val, "SecondaryWinsServer", &n.SecondaryWinsServer) delete(rawMsg, key) case "subnetMask": - err = unpopulate(val, "SubnetMask", &n.SubnetMask) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationsList. -func (o OperationsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationsList. -func (o *OperationsList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OsProfile. -func (o OsProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "adminPassword", o.AdminPassword) - populate(objectMap, "adminUsername", o.AdminUsername) - populate(objectMap, "allowExtensionOperations", o.AllowExtensionOperations) - populate(objectMap, "computerName", o.ComputerName) - populate(objectMap, "guestId", o.GuestID) - populate(objectMap, "linuxConfiguration", o.LinuxConfiguration) - populate(objectMap, "osName", o.OSName) - populate(objectMap, "osType", o.OSType) - populate(objectMap, "toolsRunningStatus", o.ToolsRunningStatus) - populate(objectMap, "toolsVersion", o.ToolsVersion) - populate(objectMap, "toolsVersionStatus", o.ToolsVersionStatus) - populate(objectMap, "windowsConfiguration", o.WindowsConfiguration) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfile. -func (o *OsProfile) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "adminPassword": - err = unpopulate(val, "AdminPassword", &o.AdminPassword) - delete(rawMsg, key) - case "adminUsername": - err = unpopulate(val, "AdminUsername", &o.AdminUsername) - delete(rawMsg, key) - case "allowExtensionOperations": - err = unpopulate(val, "AllowExtensionOperations", &o.AllowExtensionOperations) - delete(rawMsg, key) - case "computerName": - err = unpopulate(val, "ComputerName", &o.ComputerName) - delete(rawMsg, key) - case "guestId": - err = unpopulate(val, "GuestID", &o.GuestID) - delete(rawMsg, key) - case "linuxConfiguration": - err = unpopulate(val, "LinuxConfiguration", &o.LinuxConfiguration) - delete(rawMsg, key) - case "osName": - err = unpopulate(val, "OSName", &o.OSName) - delete(rawMsg, key) - case "osType": - err = unpopulate(val, "OSType", &o.OSType) - delete(rawMsg, key) - case "toolsRunningStatus": - err = unpopulate(val, "ToolsRunningStatus", &o.ToolsRunningStatus) - delete(rawMsg, key) - case "toolsVersion": - err = unpopulate(val, "ToolsVersion", &o.ToolsVersion) - delete(rawMsg, key) - case "toolsVersionStatus": - err = unpopulate(val, "ToolsVersionStatus", &o.ToolsVersionStatus) - delete(rawMsg, key) - case "windowsConfiguration": - err = unpopulate(val, "WindowsConfiguration", &o.WindowsConfiguration) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OsProfileLinuxConfiguration. -func (o OsProfileLinuxConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "patchSettings", o.PatchSettings) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileLinuxConfiguration. -func (o *OsProfileLinuxConfiguration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "patchSettings": - err = unpopulate(val, "PatchSettings", &o.PatchSettings) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OsProfileUpdate. -func (o OsProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "linuxConfiguration", o.LinuxConfiguration) - populate(objectMap, "windowsConfiguration", o.WindowsConfiguration) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdate. -func (o *OsProfileUpdate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "linuxConfiguration": - err = unpopulate(val, "LinuxConfiguration", &o.LinuxConfiguration) - delete(rawMsg, key) - case "windowsConfiguration": - err = unpopulate(val, "WindowsConfiguration", &o.WindowsConfiguration) + err = unpopulate(val, "SubnetMask", &n.SubnetMask) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OsProfileUpdateLinuxConfiguration. -func (o OsProfileUpdateLinuxConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "patchSettings", o.PatchSettings) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdateLinuxConfiguration. -func (o *OsProfileUpdateLinuxConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -2166,8 +1416,14 @@ func (o *OsProfileUpdateLinuxConfiguration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "patchSettings": - err = unpopulate(val, "PatchSettings", &o.PatchSettings) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) } if err != nil { @@ -2177,15 +1433,18 @@ func (o *OsProfileUpdateLinuxConfiguration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OsProfileUpdateWindowsConfiguration. -func (o OsProfileUpdateWindowsConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "patchSettings", o.PatchSettings) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdateWindowsConfiguration. -func (o *OsProfileUpdateWindowsConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -2193,8 +1452,17 @@ func (o *OsProfileUpdateWindowsConfiguration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "patchSettings": - err = unpopulate(val, "PatchSettings", &o.PatchSettings) + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) delete(rawMsg, key) } if err != nil { @@ -2204,15 +1472,16 @@ func (o *OsProfileUpdateWindowsConfiguration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OsProfileWindowsConfiguration. -func (o OsProfileWindowsConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationsList. +func (o OperationsList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "patchSettings", o.PatchSettings) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileWindowsConfiguration. -func (o *OsProfileWindowsConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationsList. +func (o *OperationsList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -2220,8 +1489,11 @@ func (o *OsProfileWindowsConfiguration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "patchSettings": - err = unpopulate(val, "PatchSettings", &o.PatchSettings) + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) } if err != nil { @@ -2231,32 +1503,60 @@ func (o *OsProfileWindowsConfiguration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PatchSettings. -func (p PatchSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OsProfileForVMInstance. +func (o OsProfileForVMInstance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "assessmentMode", p.AssessmentMode) - populate(objectMap, "patchMode", p.PatchMode) + populate(objectMap, "adminPassword", o.AdminPassword) + populate(objectMap, "adminUsername", o.AdminUsername) + populate(objectMap, "computerName", o.ComputerName) + populate(objectMap, "guestId", o.GuestID) + populate(objectMap, "osSku", o.OSSKU) + populate(objectMap, "osType", o.OSType) + populate(objectMap, "toolsRunningStatus", o.ToolsRunningStatus) + populate(objectMap, "toolsVersion", o.ToolsVersion) + populate(objectMap, "toolsVersionStatus", o.ToolsVersionStatus) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PatchSettings. -func (p *PatchSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileForVMInstance. +func (o *OsProfileForVMInstance) 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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "assessmentMode": - err = unpopulate(val, "AssessmentMode", &p.AssessmentMode) + case "adminPassword": + err = unpopulate(val, "AdminPassword", &o.AdminPassword) + delete(rawMsg, key) + case "adminUsername": + err = unpopulate(val, "AdminUsername", &o.AdminUsername) + delete(rawMsg, key) + case "computerName": + err = unpopulate(val, "ComputerName", &o.ComputerName) + delete(rawMsg, key) + case "guestId": + err = unpopulate(val, "GuestID", &o.GuestID) + delete(rawMsg, key) + case "osSku": + err = unpopulate(val, "OSSKU", &o.OSSKU) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &o.OSType) + delete(rawMsg, key) + case "toolsRunningStatus": + err = unpopulate(val, "ToolsRunningStatus", &o.ToolsRunningStatus) delete(rawMsg, key) - case "patchMode": - err = unpopulate(val, "PatchMode", &p.PatchMode) + case "toolsVersion": + err = unpopulate(val, "ToolsVersion", &o.ToolsVersion) + delete(rawMsg, key) + case "toolsVersionStatus": + err = unpopulate(val, "ToolsVersionStatus", &o.ToolsVersionStatus) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil @@ -2437,16 +1737,22 @@ func (r *ResourcePoolInventoryItem) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourcePoolProperties. func (r ResourcePoolProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "cpuCapacityMHz", r.CPUCapacityMHz) populate(objectMap, "cpuLimitMHz", r.CPULimitMHz) + populate(objectMap, "cpuOverallUsageMHz", r.CPUOverallUsageMHz) 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, "memCapacityGB", r.MemCapacityGB) populate(objectMap, "memLimitMB", r.MemLimitMB) + populate(objectMap, "memOverallUsageGB", r.MemOverallUsageGB) 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) @@ -2463,9 +1769,15 @@ func (r *ResourcePoolProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "cpuCapacityMHz": + err = unpopulate(val, "CPUCapacityMHz", &r.CPUCapacityMHz) + delete(rawMsg, key) case "cpuLimitMHz": err = unpopulate(val, "CPULimitMHz", &r.CPULimitMHz) delete(rawMsg, key) + case "cpuOverallUsageMHz": + err = unpopulate(val, "CPUOverallUsageMHz", &r.CPUOverallUsageMHz) + delete(rawMsg, key) case "cpuReservationMHz": err = unpopulate(val, "CPUReservationMHz", &r.CPUReservationMHz) delete(rawMsg, key) @@ -2475,12 +1787,21 @@ 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) + case "memCapacityGB": + err = unpopulate(val, "MemCapacityGB", &r.MemCapacityGB) + delete(rawMsg, key) case "memLimitMB": err = unpopulate(val, "MemLimitMB", &r.MemLimitMB) delete(rawMsg, key) + case "memOverallUsageGB": + err = unpopulate(val, "MemOverallUsageGB", &r.MemOverallUsageGB) + delete(rawMsg, key) case "memReservationMB": err = unpopulate(val, "MemReservationMB", &r.MemReservationMB) delete(rawMsg, key) @@ -2493,6 +1814,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) @@ -2961,6 +2285,115 @@ func (v *VICredential) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type VMInstanceHybridIdentityMetadata. +func (v VMInstanceHybridIdentityMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMInstanceHybridIdentityMetadata. +func (v *VMInstanceHybridIdentityMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMInstanceHybridIdentityMetadataList. +func (v VMInstanceHybridIdentityMetadataList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMInstanceHybridIdentityMetadataList. +func (v *VMInstanceHybridIdentityMetadataList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMInstanceHybridIdentityMetadataProperties. +func (v VMInstanceHybridIdentityMetadataProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "publicKey", v.PublicKey) + populate(objectMap, "resourceUid", v.ResourceUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMInstanceHybridIdentityMetadataProperties. +func (v *VMInstanceHybridIdentityMetadataProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "publicKey": + err = unpopulate(val, "PublicKey", &v.PublicKey) + delete(rawMsg, key) + case "resourceUid": + err = unpopulate(val, "ResourceUID", &v.ResourceUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VirtualDisk. func (v VirtualDisk) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3079,24 +2512,20 @@ func (v *VirtualDiskUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualMachine. -func (v VirtualMachine) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstance. +func (v VirtualMachineInstance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "extendedLocation", v.ExtendedLocation) populate(objectMap, "id", v.ID) - populate(objectMap, "identity", v.Identity) - populate(objectMap, "kind", v.Kind) - populate(objectMap, "location", v.Location) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) populate(objectMap, "systemData", v.SystemData) - populate(objectMap, "tags", v.Tags) populate(objectMap, "type", v.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachine. -func (v *VirtualMachine) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstance. +func (v *VirtualMachineInstance) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -3110,15 +2539,6 @@ func (v *VirtualMachine) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &v.Identity) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &v.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &v.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) @@ -3128,9 +2548,6 @@ func (v *VirtualMachine) UnmarshalJSON(data []byte) error { case "systemData": err = unpopulate(val, "SystemData", &v.SystemData) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &v.Tags) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &v.Type) delete(rawMsg, key) @@ -3142,24 +2559,25 @@ func (v *VirtualMachine) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineAssessPatchesResult. -func (v VirtualMachineAssessPatchesResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstanceProperties. +func (v VirtualMachineInstanceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "assessmentActivityId", v.AssessmentActivityID) - populate(objectMap, "availablePatchCountByClassification", v.AvailablePatchCountByClassification) - populate(objectMap, "errorDetails", v.ErrorDetails) - populateTimeRFC3339(objectMap, "lastModifiedDateTime", v.LastModifiedDateTime) - populate(objectMap, "osType", v.OSType) - populate(objectMap, "patchServiceUsed", v.PatchServiceUsed) - populate(objectMap, "rebootPending", v.RebootPending) - populateTimeRFC3339(objectMap, "startDateTime", v.StartDateTime) - populate(objectMap, "startedBy", v.StartedBy) - populate(objectMap, "status", v.Status) + populate(objectMap, "hardwareProfile", v.HardwareProfile) + populate(objectMap, "infrastructureProfile", v.InfrastructureProfile) + populate(objectMap, "networkProfile", v.NetworkProfile) + populate(objectMap, "osProfile", v.OSProfile) + populate(objectMap, "placementProfile", v.PlacementProfile) + populate(objectMap, "powerState", v.PowerState) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "resourceUid", v.ResourceUID) + populate(objectMap, "securityProfile", v.SecurityProfile) + populate(objectMap, "statuses", v.Statuses) + populate(objectMap, "storageProfile", v.StorageProfile) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineAssessPatchesResult. -func (v *VirtualMachineAssessPatchesResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstanceProperties. +func (v *VirtualMachineInstanceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -3167,35 +2585,38 @@ func (v *VirtualMachineAssessPatchesResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "assessmentActivityId": - err = unpopulate(val, "AssessmentActivityID", &v.AssessmentActivityID) + case "hardwareProfile": + err = unpopulate(val, "HardwareProfile", &v.HardwareProfile) delete(rawMsg, key) - case "availablePatchCountByClassification": - err = unpopulate(val, "AvailablePatchCountByClassification", &v.AvailablePatchCountByClassification) + case "infrastructureProfile": + err = unpopulate(val, "InfrastructureProfile", &v.InfrastructureProfile) delete(rawMsg, key) - case "errorDetails": - err = unpopulate(val, "ErrorDetails", &v.ErrorDetails) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &v.NetworkProfile) delete(rawMsg, key) - case "lastModifiedDateTime": - err = unpopulateTimeRFC3339(val, "LastModifiedDateTime", &v.LastModifiedDateTime) + case "osProfile": + err = unpopulate(val, "OSProfile", &v.OSProfile) delete(rawMsg, key) - case "osType": - err = unpopulate(val, "OSType", &v.OSType) + case "placementProfile": + err = unpopulate(val, "PlacementProfile", &v.PlacementProfile) delete(rawMsg, key) - case "patchServiceUsed": - err = unpopulate(val, "PatchServiceUsed", &v.PatchServiceUsed) + case "powerState": + err = unpopulate(val, "PowerState", &v.PowerState) delete(rawMsg, key) - case "rebootPending": - err = unpopulate(val, "RebootPending", &v.RebootPending) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &v.StartDateTime) + case "resourceUid": + err = unpopulate(val, "ResourceUID", &v.ResourceUID) delete(rawMsg, key) - case "startedBy": - err = unpopulate(val, "StartedBy", &v.StartedBy) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &v.SecurityProfile) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &v.Status) + case "statuses": + err = unpopulate(val, "Statuses", &v.Statuses) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &v.StorageProfile) delete(rawMsg, key) } if err != nil { @@ -3205,18 +2626,15 @@ func (v *VirtualMachineAssessPatchesResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstallPatchesParameters. -func (v VirtualMachineInstallPatchesParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstanceUpdate. +func (v VirtualMachineInstanceUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "linuxParameters", v.LinuxParameters) - populate(objectMap, "maximumDuration", v.MaximumDuration) - populate(objectMap, "rebootSetting", v.RebootSetting) - populate(objectMap, "windowsParameters", v.WindowsParameters) + populate(objectMap, "properties", v.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstallPatchesParameters. -func (v *VirtualMachineInstallPatchesParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstanceUpdate. +func (v *VirtualMachineInstanceUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -3224,17 +2642,43 @@ func (v *VirtualMachineInstallPatchesParameters) UnmarshalJSON(data []byte) erro for key, val := range rawMsg { var err error switch key { - case "linuxParameters": - err = unpopulate(val, "LinuxParameters", &v.LinuxParameters) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) delete(rawMsg, key) - case "maximumDuration": - err = unpopulate(val, "MaximumDuration", &v.MaximumDuration) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstanceUpdateProperties. +func (v VirtualMachineInstanceUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hardwareProfile", v.HardwareProfile) + populate(objectMap, "networkProfile", v.NetworkProfile) + populate(objectMap, "storageProfile", v.StorageProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstanceUpdateProperties. +func (v *VirtualMachineInstanceUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hardwareProfile": + err = unpopulate(val, "HardwareProfile", &v.HardwareProfile) delete(rawMsg, key) - case "rebootSetting": - err = unpopulate(val, "RebootSetting", &v.RebootSetting) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &v.NetworkProfile) delete(rawMsg, key) - case "windowsParameters": - err = unpopulate(val, "WindowsParameters", &v.WindowsParameters) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &v.StorageProfile) delete(rawMsg, key) } if err != nil { @@ -3244,29 +2688,16 @@ func (v *VirtualMachineInstallPatchesParameters) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstallPatchesResult. -func (v VirtualMachineInstallPatchesResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstancesList. +func (v VirtualMachineInstancesList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "errorDetails", v.ErrorDetails) - populate(objectMap, "excludedPatchCount", v.ExcludedPatchCount) - populate(objectMap, "failedPatchCount", v.FailedPatchCount) - populate(objectMap, "installationActivityId", v.InstallationActivityID) - populate(objectMap, "installedPatchCount", v.InstalledPatchCount) - populateTimeRFC3339(objectMap, "lastModifiedDateTime", v.LastModifiedDateTime) - populate(objectMap, "maintenanceWindowExceeded", v.MaintenanceWindowExceeded) - populate(objectMap, "notSelectedPatchCount", v.NotSelectedPatchCount) - populate(objectMap, "osType", v.OSType) - populate(objectMap, "patchServiceUsed", v.PatchServiceUsed) - populate(objectMap, "pendingPatchCount", v.PendingPatchCount) - populate(objectMap, "rebootStatus", v.RebootStatus) - populateTimeRFC3339(objectMap, "startDateTime", v.StartDateTime) - populate(objectMap, "startedBy", v.StartedBy) - populate(objectMap, "status", v.Status) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstallPatchesResult. -func (v *VirtualMachineInstallPatchesResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancesList. +func (v *VirtualMachineInstancesList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -3274,50 +2705,11 @@ func (v *VirtualMachineInstallPatchesResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "errorDetails": - err = unpopulate(val, "ErrorDetails", &v.ErrorDetails) - delete(rawMsg, key) - case "excludedPatchCount": - err = unpopulate(val, "ExcludedPatchCount", &v.ExcludedPatchCount) - delete(rawMsg, key) - case "failedPatchCount": - err = unpopulate(val, "FailedPatchCount", &v.FailedPatchCount) - delete(rawMsg, key) - case "installationActivityId": - err = unpopulate(val, "InstallationActivityID", &v.InstallationActivityID) - delete(rawMsg, key) - case "installedPatchCount": - err = unpopulate(val, "InstalledPatchCount", &v.InstalledPatchCount) - delete(rawMsg, key) - case "lastModifiedDateTime": - err = unpopulateTimeRFC3339(val, "LastModifiedDateTime", &v.LastModifiedDateTime) - delete(rawMsg, key) - case "maintenanceWindowExceeded": - err = unpopulate(val, "MaintenanceWindowExceeded", &v.MaintenanceWindowExceeded) - delete(rawMsg, key) - case "notSelectedPatchCount": - err = unpopulate(val, "NotSelectedPatchCount", &v.NotSelectedPatchCount) - delete(rawMsg, key) - case "osType": - err = unpopulate(val, "OSType", &v.OSType) - delete(rawMsg, key) - case "patchServiceUsed": - err = unpopulate(val, "PatchServiceUsed", &v.PatchServiceUsed) - delete(rawMsg, key) - case "pendingPatchCount": - err = unpopulate(val, "PendingPatchCount", &v.PendingPatchCount) - delete(rawMsg, key) - case "rebootStatus": - err = unpopulate(val, "RebootStatus", &v.RebootStatus) - delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &v.StartDateTime) - delete(rawMsg, key) - case "startedBy": - err = unpopulate(val, "StartedBy", &v.StartedBy) + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &v.Status) + case "value": + err = unpopulate(val, "Value", &v.Value) delete(rawMsg, key) } if err != nil { @@ -3330,6 +2722,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]any) + populate(objectMap, "cluster", v.Cluster) populate(objectMap, "folderPath", v.FolderPath) populate(objectMap, "host", v.Host) populate(objectMap, "ipAddresses", v.IPAddresses) @@ -3359,6 +2752,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) @@ -3418,121 +2814,6 @@ func (v *VirtualMachineInventoryItem) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineProperties. -func (v VirtualMachineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "customResourceName", v.CustomResourceName) - populate(objectMap, "firmwareType", v.FirmwareType) - populate(objectMap, "folderPath", v.FolderPath) - populate(objectMap, "guestAgentProfile", v.GuestAgentProfile) - populate(objectMap, "hardwareProfile", v.HardwareProfile) - populate(objectMap, "instanceUuid", v.InstanceUUID) - populate(objectMap, "inventoryItemId", v.InventoryItemID) - populate(objectMap, "moName", v.MoName) - populate(objectMap, "moRefId", v.MoRefID) - populate(objectMap, "networkProfile", v.NetworkProfile) - populate(objectMap, "osProfile", v.OSProfile) - populate(objectMap, "placementProfile", v.PlacementProfile) - populate(objectMap, "powerState", v.PowerState) - populate(objectMap, "provisioningState", v.ProvisioningState) - populate(objectMap, "resourcePoolId", v.ResourcePoolID) - populate(objectMap, "securityProfile", v.SecurityProfile) - populate(objectMap, "smbiosUuid", v.SmbiosUUID) - populate(objectMap, "statuses", v.Statuses) - populate(objectMap, "storageProfile", v.StorageProfile) - populate(objectMap, "templateId", v.TemplateID) - populate(objectMap, "uuid", v.UUID) - populate(objectMap, "vCenterId", v.VCenterID) - populate(objectMap, "vmId", v.VMID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineProperties. -func (v *VirtualMachineProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "customResourceName": - err = unpopulate(val, "CustomResourceName", &v.CustomResourceName) - delete(rawMsg, key) - case "firmwareType": - err = unpopulate(val, "FirmwareType", &v.FirmwareType) - delete(rawMsg, key) - case "folderPath": - err = unpopulate(val, "FolderPath", &v.FolderPath) - delete(rawMsg, key) - case "guestAgentProfile": - err = unpopulate(val, "GuestAgentProfile", &v.GuestAgentProfile) - delete(rawMsg, key) - case "hardwareProfile": - err = unpopulate(val, "HardwareProfile", &v.HardwareProfile) - delete(rawMsg, key) - case "instanceUuid": - err = unpopulate(val, "InstanceUUID", &v.InstanceUUID) - delete(rawMsg, key) - case "inventoryItemId": - err = unpopulate(val, "InventoryItemID", &v.InventoryItemID) - delete(rawMsg, key) - case "moName": - err = unpopulate(val, "MoName", &v.MoName) - delete(rawMsg, key) - case "moRefId": - err = unpopulate(val, "MoRefID", &v.MoRefID) - delete(rawMsg, key) - case "networkProfile": - err = unpopulate(val, "NetworkProfile", &v.NetworkProfile) - delete(rawMsg, key) - case "osProfile": - err = unpopulate(val, "OSProfile", &v.OSProfile) - delete(rawMsg, key) - case "placementProfile": - err = unpopulate(val, "PlacementProfile", &v.PlacementProfile) - delete(rawMsg, key) - case "powerState": - err = unpopulate(val, "PowerState", &v.PowerState) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) - delete(rawMsg, key) - case "resourcePoolId": - err = unpopulate(val, "ResourcePoolID", &v.ResourcePoolID) - delete(rawMsg, key) - case "securityProfile": - err = unpopulate(val, "SecurityProfile", &v.SecurityProfile) - delete(rawMsg, key) - case "smbiosUuid": - err = unpopulate(val, "SmbiosUUID", &v.SmbiosUUID) - delete(rawMsg, key) - case "statuses": - err = unpopulate(val, "Statuses", &v.Statuses) - delete(rawMsg, key) - case "storageProfile": - err = unpopulate(val, "StorageProfile", &v.StorageProfile) - delete(rawMsg, key) - case "templateId": - err = unpopulate(val, "TemplateID", &v.TemplateID) - delete(rawMsg, key) - case "uuid": - err = unpopulate(val, "UUID", &v.UUID) - delete(rawMsg, key) - case "vCenterId": - err = unpopulate(val, "VCenterID", &v.VCenterID) - delete(rawMsg, key) - case "vmId": - err = unpopulate(val, "VMID", &v.VMID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type VirtualMachineTemplate. func (v VirtualMachineTemplate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3606,6 +2887,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) } @@ -3651,6 +2934,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) @@ -3789,111 +3078,6 @@ func (v *VirtualMachineTemplatesList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineUpdate. -func (v VirtualMachineUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "identity", v.Identity) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "tags", v.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineUpdate. -func (v *VirtualMachineUpdate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "identity": - err = unpopulate(val, "Identity", &v.Identity) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &v.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &v.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineUpdateProperties. -func (v VirtualMachineUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "hardwareProfile", v.HardwareProfile) - populate(objectMap, "networkProfile", v.NetworkProfile) - populate(objectMap, "osProfile", v.OSProfile) - populate(objectMap, "storageProfile", v.StorageProfile) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineUpdateProperties. -func (v *VirtualMachineUpdateProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "hardwareProfile": - err = unpopulate(val, "HardwareProfile", &v.HardwareProfile) - delete(rawMsg, key) - case "networkProfile": - err = unpopulate(val, "NetworkProfile", &v.NetworkProfile) - delete(rawMsg, key) - case "osProfile": - err = unpopulate(val, "OSProfile", &v.OSProfile) - delete(rawMsg, key) - case "storageProfile": - err = unpopulate(val, "StorageProfile", &v.StorageProfile) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type VirtualMachinesList. -func (v VirtualMachinesList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", v.NextLink) - populate(objectMap, "value", v.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachinesList. -func (v *VirtualMachinesList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &v.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &v.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type VirtualNetwork. func (v VirtualNetwork) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4125,49 +3309,6 @@ func (v *VirtualSCSIController) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WindowsParameters. -func (w WindowsParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "classificationsToInclude", w.ClassificationsToInclude) - populate(objectMap, "excludeKbsRequiringReboot", w.ExcludeKbsRequiringReboot) - populate(objectMap, "kbNumbersToExclude", w.KbNumbersToExclude) - populate(objectMap, "kbNumbersToInclude", w.KbNumbersToInclude) - populateTimeRFC3339(objectMap, "maxPatchPublishDate", w.MaxPatchPublishDate) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsParameters. -func (w *WindowsParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "classificationsToInclude": - err = unpopulate(val, "ClassificationsToInclude", &w.ClassificationsToInclude) - delete(rawMsg, key) - case "excludeKbsRequiringReboot": - err = unpopulate(val, "ExcludeKbsRequiringReboot", &w.ExcludeKbsRequiringReboot) - delete(rawMsg, key) - case "kbNumbersToExclude": - err = unpopulate(val, "KbNumbersToExclude", &w.KbNumbersToExclude) - delete(rawMsg, key) - case "kbNumbersToInclude": - err = unpopulate(val, "KbNumbersToInclude", &w.KbNumbersToInclude) - delete(rawMsg, key) - case "maxPatchPublishDate": - err = unpopulateTimeRFC3339(val, "MaxPatchPublishDate", &w.MaxPatchPublishDate) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - func populate(m map[string]any, k string, v any) { if v == nil { return @@ -4178,16 +3319,6 @@ func populate(m map[string]any, k string, v any) { } } -func populateAny(m map[string]any, k string, v any) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else { - m[k] = v - } -} - func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/operations_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/operations_client.go index d78d71bc39e2..a3b88afe7fc8 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/operations_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/operations_client.go @@ -13,7 +13,7 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware @@ -48,7 +48,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Returns list of all operations. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -86,7 +86,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", "2023-10-01") 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 56b6b17746d6..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/operations_client_example_test.go +++ /dev/null @@ -1,244 +0,0 @@ -//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_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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationsList = armconnectedvmware.OperationsList{ - // Value: []*armconnectedvmware.Operation{ - // { - // Name: to.Ptr("microsoft.vmware/vcenters/Read"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Read vcenters"), - // Operation: to.Ptr("Gets/List vcenters resources"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("vcenters"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/vcenters/Write"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Writes vcenters"), - // Operation: to.Ptr("Create/update vcenters resources"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("vcenters"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/vcenters/Delete"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Deletes vcenters"), - // Operation: to.Ptr("Deletes vcenters resource"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("vcenters"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/resourcepools/Read"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Read resourcepools"), - // Operation: to.Ptr("Gets/List resourcepools resources"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("resourcepools"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/resourcepools/Write"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Writes resourcepools"), - // Operation: to.Ptr("Create/update resourcepools resources"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("resourcepools"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/resourcepools/Delete"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Deletes resourcepools"), - // Operation: to.Ptr("Deletes resourcepools resource"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("resourcepools"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/virtualmachines/Read"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Read virtualmachines"), - // Operation: to.Ptr("Gets/List virtualmachines resources"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("virtualmachines"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/virtualmachines/Write"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Writes virtualmachines"), - // Operation: to.Ptr("Create/update virtualmachines resources"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("virtualmachines"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/virtualmachines/Delete"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Deletes virtualmachines"), - // Operation: to.Ptr("Deletes virtualmachines resource"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("virtualmachines"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/virtualmachinetemplates/Read"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Read virtualmachinetemplates"), - // Operation: to.Ptr("Gets/List virtualmachinetemplates resources"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("virtualmachinetemplates"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/virtualmachinetemplates/Write"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Writes virtualmachinetemplates"), - // Operation: to.Ptr("Create/update virtualmachinetemplates resources"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("virtualmachinetemplates"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/virtualmachinetemplates/Delete"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Deletes virtualmachinetemplates"), - // Operation: to.Ptr("Deletes virtualmachinetemplates resource"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("virtualmachinetemplates"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/virtualnetworks/Read"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Read virtualnetworks"), - // Operation: to.Ptr("Gets/List virtualnetworks resources"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("virtualnetworks"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/virtualnetworks/Write"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Writes virtualnetworks"), - // Operation: to.Ptr("Create/update virtualnetworks resources"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("virtualnetworks"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/virtualnetworks/Delete"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Deletes virtualnetworks"), - // Operation: to.Ptr("Deletes virtualnetworks resource"), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("virtualnetworks"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/arczones/deploy/action"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Deploy on arczone."), - // Operation: to.Ptr("Deploy on arczone."), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("arczones"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/virtualmachinetemplates/clone/action"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Clone on virtual machine templates."), - // Operation: to.Ptr("Clone on virtual machine templates."), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("virtualmachinetemplates"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/resourcepools/deploy/action"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Deploy on resource pool."), - // Operation: to.Ptr("Deploy on resource pool."), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("resourcepools"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("microsoft.vmware/virtualnetworks/join/action"), - // Display: &armconnectedvmware.OperationDisplay{ - // Description: to.Ptr("Join virtual network."), - // Operation: to.Ptr("Join virtual network."), - // Provider: to.Ptr("microsoft.vmware"), - // Resource: to.Ptr("virtualnetworks"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/options.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/options.go new file mode 100644 index 000000000000..8ca793ddb4c9 --- /dev/null +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/options.go @@ -0,0 +1,399 @@ +//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. +// Code generated by @autorest/go. DO NOT EDIT. + +package armconnectedvmware + +// ClustersClientBeginCreateOptions contains the optional parameters for the ClustersClient.BeginCreate method. +type ClustersClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. +type ClustersClientBeginDeleteOptions struct { + // Whether force delete was specified. + Force *bool + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. +type ClustersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager +// method. +type ClustersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListOptions contains the optional parameters for the ClustersClient.NewListPager method. +type ClustersClientListOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientUpdateOptions contains the optional parameters for the ClustersClient.Update method. +type ClustersClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// DatastoresClientBeginCreateOptions contains the optional parameters for the DatastoresClient.BeginCreate method. +type DatastoresClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatastoresClientBeginDeleteOptions contains the optional parameters for the DatastoresClient.BeginDelete method. +type DatastoresClientBeginDeleteOptions struct { + // Whether force delete was specified. + Force *bool + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatastoresClientGetOptions contains the optional parameters for the DatastoresClient.Get method. +type DatastoresClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatastoresClientListByResourceGroupOptions contains the optional parameters for the DatastoresClient.NewListByResourceGroupPager +// method. +type DatastoresClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DatastoresClientListOptions contains the optional parameters for the DatastoresClient.NewListPager method. +type DatastoresClientListOptions struct { + // placeholder for future optional parameters +} + +// DatastoresClientUpdateOptions contains the optional parameters for the DatastoresClient.Update method. +type DatastoresClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// HostsClientBeginCreateOptions contains the optional parameters for the HostsClient.BeginCreate method. +type HostsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HostsClientBeginDeleteOptions contains the optional parameters for the HostsClient.BeginDelete method. +type HostsClientBeginDeleteOptions struct { + // Whether force delete was specified. + Force *bool + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HostsClientGetOptions contains the optional parameters for the HostsClient.Get method. +type HostsClientGetOptions struct { + // placeholder for future optional parameters +} + +// HostsClientListByResourceGroupOptions contains the optional parameters for the HostsClient.NewListByResourceGroupPager +// method. +type HostsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// HostsClientListOptions contains the optional parameters for the HostsClient.NewListPager method. +type HostsClientListOptions struct { + // placeholder for future optional parameters +} + +// HostsClientUpdateOptions contains the optional parameters for the HostsClient.Update method. +type HostsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// InventoryItemsClientCreateOptions contains the optional parameters for the InventoryItemsClient.Create method. +type InventoryItemsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// InventoryItemsClientDeleteOptions contains the optional parameters for the InventoryItemsClient.Delete method. +type InventoryItemsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// InventoryItemsClientGetOptions contains the optional parameters for the InventoryItemsClient.Get method. +type InventoryItemsClientGetOptions struct { + // placeholder for future optional parameters +} + +// InventoryItemsClientListByVCenterOptions contains the optional parameters for the InventoryItemsClient.NewListByVCenterPager +// method. +type InventoryItemsClientListByVCenterOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ResourcePoolsClientBeginCreateOptions contains the optional parameters for the ResourcePoolsClient.BeginCreate method. +type ResourcePoolsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ResourcePoolsClientBeginDeleteOptions contains the optional parameters for the ResourcePoolsClient.BeginDelete method. +type ResourcePoolsClientBeginDeleteOptions struct { + // Whether force delete was specified. + Force *bool + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ResourcePoolsClientGetOptions contains the optional parameters for the ResourcePoolsClient.Get method. +type ResourcePoolsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ResourcePoolsClientListByResourceGroupOptions contains the optional parameters for the ResourcePoolsClient.NewListByResourceGroupPager +// method. +type ResourcePoolsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ResourcePoolsClientListOptions contains the optional parameters for the ResourcePoolsClient.NewListPager method. +type ResourcePoolsClientListOptions struct { + // placeholder for future optional parameters +} + +// ResourcePoolsClientUpdateOptions contains the optional parameters for the ResourcePoolsClient.Update method. +type ResourcePoolsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// VCentersClientBeginCreateOptions contains the optional parameters for the VCentersClient.BeginCreate method. +type VCentersClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VCentersClientBeginDeleteOptions contains the optional parameters for the VCentersClient.BeginDelete method. +type VCentersClientBeginDeleteOptions struct { + // Whether force delete was specified. + Force *bool + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VCentersClientGetOptions contains the optional parameters for the VCentersClient.Get method. +type VCentersClientGetOptions struct { + // placeholder for future optional parameters +} + +// VCentersClientListByResourceGroupOptions contains the optional parameters for the VCentersClient.NewListByResourceGroupPager +// method. +type VCentersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VCentersClientListOptions contains the optional parameters for the VCentersClient.NewListPager method. +type VCentersClientListOptions struct { + // placeholder for future optional parameters +} + +// VCentersClientUpdateOptions contains the optional parameters for the VCentersClient.Update method. +type VCentersClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// VMInstanceGuestAgentsClientBeginCreateOptions contains the optional parameters for the VMInstanceGuestAgentsClient.BeginCreate +// method. +type VMInstanceGuestAgentsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VMInstanceGuestAgentsClientBeginDeleteOptions contains the optional parameters for the VMInstanceGuestAgentsClient.BeginDelete +// method. +type VMInstanceGuestAgentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VMInstanceGuestAgentsClientGetOptions contains the optional parameters for the VMInstanceGuestAgentsClient.Get method. +type VMInstanceGuestAgentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VMInstanceGuestAgentsClientListOptions contains the optional parameters for the VMInstanceGuestAgentsClient.NewListPager +// method. +type VMInstanceGuestAgentsClientListOptions struct { + // placeholder for future optional parameters +} + +// VMInstanceHybridIdentityMetadataClientGetOptions contains the optional parameters for the VMInstanceHybridIdentityMetadataClient.Get +// method. +type VMInstanceHybridIdentityMetadataClientGetOptions struct { + // placeholder for future optional parameters +} + +// VMInstanceHybridIdentityMetadataClientListOptions contains the optional parameters for the VMInstanceHybridIdentityMetadataClient.NewListPager +// method. +type VMInstanceHybridIdentityMetadataClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginCreateOrUpdate +// method. +type VirtualMachineInstancesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineInstancesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginDelete +// method. +type VirtualMachineInstancesClientBeginDeleteOptions struct { + // Whether to delete the VM from the vCenter. + DeleteFromHost *bool + + // Whether force delete was specified. + Force *bool + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineInstancesClientBeginRestartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginRestart +// method. +type VirtualMachineInstancesClientBeginRestartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineInstancesClientBeginStartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginStart +// method. +type VirtualMachineInstancesClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineInstancesClientBeginStopOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginStop +// method. +type VirtualMachineInstancesClientBeginStopOptions struct { + // Virtualmachine stop action payload. + Body *StopVirtualMachineOptions + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineInstancesClientBeginUpdateOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginUpdate +// method. +type VirtualMachineInstancesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineInstancesClientGetOptions contains the optional parameters for the VirtualMachineInstancesClient.Get method. +type VirtualMachineInstancesClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineInstancesClientListOptions contains the optional parameters for the VirtualMachineInstancesClient.NewListPager +// method. +type VirtualMachineInstancesClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineTemplatesClientBeginCreateOptions contains the optional parameters for the VirtualMachineTemplatesClient.BeginCreate +// method. +type VirtualMachineTemplatesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineTemplatesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineTemplatesClient.BeginDelete +// method. +type VirtualMachineTemplatesClientBeginDeleteOptions struct { + // Whether force delete was specified. + Force *bool + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineTemplatesClientGetOptions contains the optional parameters for the VirtualMachineTemplatesClient.Get method. +type VirtualMachineTemplatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineTemplatesClientListByResourceGroupOptions contains the optional parameters for the VirtualMachineTemplatesClient.NewListByResourceGroupPager +// method. +type VirtualMachineTemplatesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineTemplatesClientListOptions contains the optional parameters for the VirtualMachineTemplatesClient.NewListPager +// method. +type VirtualMachineTemplatesClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineTemplatesClientUpdateOptions contains the optional parameters for the VirtualMachineTemplatesClient.Update +// method. +type VirtualMachineTemplatesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientBeginCreateOptions contains the optional parameters for the VirtualNetworksClient.BeginCreate method. +type VirtualNetworksClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworksClient.BeginDelete method. +type VirtualNetworksClientBeginDeleteOptions struct { + // Whether force delete was specified. + Force *bool + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworksClientGetOptions contains the optional parameters for the VirtualNetworksClient.Get method. +type VirtualNetworksClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworksClient.NewListByResourceGroupPager +// method. +type VirtualNetworksClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientListOptions contains the optional parameters for the VirtualNetworksClient.NewListPager method. +type VirtualNetworksClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientUpdateOptions contains the optional parameters for the VirtualNetworksClient.Update method. +type VirtualNetworksClientUpdateOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/polymorphic_helpers.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/polymorphic_helpers.go index 6ddcdb956204..db0b6954bf78 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/polymorphic_helpers.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/polymorphic_helpers.go @@ -13,7 +13,7 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware @@ -46,5 +46,8 @@ func unmarshalInventoryItemPropertiesClassification(rawMsg json.RawMessage) (Inv default: b = &InventoryItemProperties{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/resourcepools_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/resourcepools_client.go index ebf98b49017e..2b8d2360d6a3 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/resourcepools_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/resourcepools_client.go @@ -13,7 +13,7 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware @@ -56,7 +56,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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - resourcePoolName - Name of the resourcePool. // - body - Request payload. @@ -68,9 +68,10 @@ func (client *ResourcePoolsClient) BeginCreate(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ResourcePoolsClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ResourcePoolsClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ResourcePoolsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -79,20 +80,22 @@ 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 2023-10-01 func (client *ResourcePoolsClient) create(ctx context.Context, resourceGroupName string, resourcePoolName string, body ResourcePool, options *ResourcePoolsClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, resourcePoolName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -115,16 +118,19 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - resourcePoolName - Name of the resourcePool. // - options - ResourcePoolsClientBeginDeleteOptions contains the optional parameters for the ResourcePoolsClient.BeginDelete @@ -135,7 +141,8 @@ func (client *ResourcePoolsClient) BeginDelete(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller[ResourcePoolsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ResourcePoolsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ResourcePoolsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -144,20 +151,22 @@ 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 2023-10-01 func (client *ResourcePoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourcePoolName string, options *ResourcePoolsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourcePoolName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -180,7 +189,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", "2023-10-01") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -192,23 +201,26 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - resourcePoolName - Name of the resourcePool. // - options - ResourcePoolsClientGetOptions contains the optional parameters for the ResourcePoolsClient.Get method. func (client *ResourcePoolsClient) Get(ctx context.Context, resourceGroupName string, resourcePoolName string, options *ResourcePoolsClientGetOptions) (ResourcePoolsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourcePoolName, options) if err != nil { return ResourcePoolsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourcePoolsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourcePoolsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourcePoolsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -231,7 +243,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +260,7 @@ func (client *ResourcePoolsClient) getHandleResponse(resp *http.Response) (Resou // NewListPager - List of resourcePools in a subscription. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - options - ResourcePoolsClientListOptions contains the optional parameters for the ResourcePoolsClient.NewListPager method. func (client *ResourcePoolsClient) NewListPager(options *ResourcePoolsClientListOptions) *runtime.Pager[ResourcePoolsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ResourcePoolsClientListResponse]{ @@ -290,7 +302,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -307,7 +319,7 @@ func (client *ResourcePoolsClient) listHandleResponse(resp *http.Response) (Reso // NewListByResourceGroupPager - List of resourcePools in a resource group. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - resourceGroupName - The Resource Group Name. // - options - ResourcePoolsClientListByResourceGroupOptions contains the optional parameters for the ResourcePoolsClient.NewListByResourceGroupPager // method. @@ -355,7 +367,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -373,24 +385,27 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - resourcePoolName - Name of the resourcePool. // - body - Resource properties to update. // - options - ResourcePoolsClientUpdateOptions contains the optional parameters for the ResourcePoolsClient.Update method. func (client *ResourcePoolsClient) Update(ctx context.Context, resourceGroupName string, resourcePoolName string, body ResourcePatch, options *ResourcePoolsClientUpdateOptions) (ResourcePoolsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, resourcePoolName, body, options) if err != nil { return ResourcePoolsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourcePoolsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourcePoolsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourcePoolsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -413,10 +428,13 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. 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 3654937b6ba4..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/resourcepools_client_example_test.go +++ /dev/null @@ -1,262 +0,0 @@ -//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_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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewResourcePoolsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourcePool = armconnectedvmware.ResourcePool{ - // Name: to.Ptr("HRPool"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/ResourcePools"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/ResourcePools/HRPool"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.ResourcePoolProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourcePoolsClient().Get(ctx, "testrg", "HRPool", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourcePool = armconnectedvmware.ResourcePool{ - // Name: to.Ptr("HRPool"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/ResourcePools"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/ResourcePools/HRPool"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.ResourcePoolProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourcePoolsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourcePool = armconnectedvmware.ResourcePool{ - // Name: to.Ptr("HRPool"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/ResourcePools"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/ResourcePools/HRPool"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.ResourcePoolProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewResourcePoolsClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourcePoolsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourcePoolsList = armconnectedvmware.ResourcePoolsList{ - // Value: []*armconnectedvmware.ResourcePool{ - // { - // Name: to.Ptr("HRPool"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/ResourcePools"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/ResourcePools/HRPool"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.ResourcePoolProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourcePoolsClient().NewListByResourceGroupPager("testrg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourcePoolsList = armconnectedvmware.ResourcePoolsList{ - // Value: []*armconnectedvmware.ResourcePool{ - // { - // Name: to.Ptr("HRPool"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/ResourcePools"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/ResourcePools/HRPool"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.ResourcePoolProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/response_types.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/response_types.go index a2f8bbf005a1..1d0ec009ec31 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/response_types.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/response_types.go @@ -13,12 +13,13 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware // ClustersClientCreateResponse contains the response from method ClustersClient.BeginCreate. type ClustersClientCreateResponse struct { + // Define the cluster. Cluster } @@ -29,26 +30,31 @@ type ClustersClientDeleteResponse struct { // ClustersClientGetResponse contains the response from method ClustersClient.Get. type ClustersClientGetResponse struct { + // Define the cluster. Cluster } // ClustersClientListByResourceGroupResponse contains the response from method ClustersClient.NewListByResourceGroupPager. type ClustersClientListByResourceGroupResponse struct { + // List of Clusters. ClustersList } // ClustersClientListResponse contains the response from method ClustersClient.NewListPager. type ClustersClientListResponse struct { + // List of Clusters. ClustersList } // ClustersClientUpdateResponse contains the response from method ClustersClient.Update. type ClustersClientUpdateResponse struct { + // Define the cluster. Cluster } // DatastoresClientCreateResponse contains the response from method DatastoresClient.BeginCreate. type DatastoresClientCreateResponse struct { + // Define the datastore. Datastore } @@ -59,46 +65,31 @@ type DatastoresClientDeleteResponse struct { // DatastoresClientGetResponse contains the response from method DatastoresClient.Get. type DatastoresClientGetResponse struct { + // Define the datastore. Datastore } // DatastoresClientListByResourceGroupResponse contains the response from method DatastoresClient.NewListByResourceGroupPager. type DatastoresClientListByResourceGroupResponse struct { + // List of Datastores. DatastoresList } // DatastoresClientListResponse contains the response from method DatastoresClient.NewListPager. type DatastoresClientListResponse struct { + // List of Datastores. DatastoresList } // DatastoresClientUpdateResponse contains the response from method DatastoresClient.Update. type DatastoresClientUpdateResponse struct { + // Define the datastore. Datastore } -// GuestAgentsClientCreateResponse contains the response from method GuestAgentsClient.BeginCreate. -type GuestAgentsClientCreateResponse struct { - GuestAgent -} - -// GuestAgentsClientDeleteResponse contains the response from method GuestAgentsClient.BeginDelete. -type GuestAgentsClientDeleteResponse struct { - // placeholder for future response values -} - -// GuestAgentsClientGetResponse contains the response from method GuestAgentsClient.Get. -type GuestAgentsClientGetResponse struct { - GuestAgent -} - -// GuestAgentsClientListByVMResponse contains the response from method GuestAgentsClient.NewListByVMPager. -type GuestAgentsClientListByVMResponse struct { - GuestAgentList -} - // HostsClientCreateResponse contains the response from method HostsClient.BeginCreate. type HostsClientCreateResponse struct { + // Define the host. Host } @@ -109,46 +100,31 @@ type HostsClientDeleteResponse struct { // HostsClientGetResponse contains the response from method HostsClient.Get. type HostsClientGetResponse struct { + // Define the host. Host } // HostsClientListByResourceGroupResponse contains the response from method HostsClient.NewListByResourceGroupPager. type HostsClientListByResourceGroupResponse struct { + // List of Hosts. HostsList } // HostsClientListResponse contains the response from method HostsClient.NewListPager. type HostsClientListResponse struct { + // List of Hosts. HostsList } // HostsClientUpdateResponse contains the response from method HostsClient.Update. type HostsClientUpdateResponse struct { + // Define the host. Host } -// HybridIdentityMetadataClientCreateResponse contains the response from method HybridIdentityMetadataClient.Create. -type HybridIdentityMetadataClientCreateResponse struct { - HybridIdentityMetadata -} - -// HybridIdentityMetadataClientDeleteResponse contains the response from method HybridIdentityMetadataClient.Delete. -type HybridIdentityMetadataClientDeleteResponse struct { - // placeholder for future response values -} - -// HybridIdentityMetadataClientGetResponse contains the response from method HybridIdentityMetadataClient.Get. -type HybridIdentityMetadataClientGetResponse struct { - HybridIdentityMetadata -} - -// HybridIdentityMetadataClientListByVMResponse contains the response from method HybridIdentityMetadataClient.NewListByVMPager. -type HybridIdentityMetadataClientListByVMResponse struct { - HybridIdentityMetadataList -} - // InventoryItemsClientCreateResponse contains the response from method InventoryItemsClient.Create. type InventoryItemsClientCreateResponse struct { + // Defines the inventory item. InventoryItem } @@ -159,46 +135,25 @@ type InventoryItemsClientDeleteResponse struct { // InventoryItemsClientGetResponse contains the response from method InventoryItemsClient.Get. type InventoryItemsClientGetResponse struct { + // Defines the inventory item. InventoryItem } // InventoryItemsClientListByVCenterResponse contains the response from method InventoryItemsClient.NewListByVCenterPager. type InventoryItemsClientListByVCenterResponse struct { + // List of InventoryItems. InventoryItemsList } -// MachineExtensionsClientCreateOrUpdateResponse contains the response from method MachineExtensionsClient.BeginCreateOrUpdate. -type MachineExtensionsClientCreateOrUpdateResponse struct { - MachineExtension -} - -// MachineExtensionsClientDeleteResponse contains the response from method MachineExtensionsClient.BeginDelete. -type MachineExtensionsClientDeleteResponse struct { - // placeholder for future response values -} - -// MachineExtensionsClientGetResponse contains the response from method MachineExtensionsClient.Get. -type MachineExtensionsClientGetResponse struct { - MachineExtension -} - -// MachineExtensionsClientListResponse contains the response from method MachineExtensionsClient.NewListPager. -type MachineExtensionsClientListResponse struct { - MachineExtensionsListResult -} - -// MachineExtensionsClientUpdateResponse contains the response from method MachineExtensionsClient.BeginUpdate. -type MachineExtensionsClientUpdateResponse struct { - MachineExtension -} - // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // Lists the operations available. OperationsList } // ResourcePoolsClientCreateResponse contains the response from method ResourcePoolsClient.BeginCreate. type ResourcePoolsClientCreateResponse struct { + // Define the resourcePool. ResourcePool } @@ -209,26 +164,31 @@ type ResourcePoolsClientDeleteResponse struct { // ResourcePoolsClientGetResponse contains the response from method ResourcePoolsClient.Get. type ResourcePoolsClientGetResponse struct { + // Define the resourcePool. ResourcePool } // ResourcePoolsClientListByResourceGroupResponse contains the response from method ResourcePoolsClient.NewListByResourceGroupPager. type ResourcePoolsClientListByResourceGroupResponse struct { + // List of ResourcePools. ResourcePoolsList } // ResourcePoolsClientListResponse contains the response from method ResourcePoolsClient.NewListPager. type ResourcePoolsClientListResponse struct { + // List of ResourcePools. ResourcePoolsList } // ResourcePoolsClientUpdateResponse contains the response from method ResourcePoolsClient.Update. type ResourcePoolsClientUpdateResponse struct { + // Define the resourcePool. ResourcePool } // VCentersClientCreateResponse contains the response from method VCentersClient.BeginCreate. type VCentersClientCreateResponse struct { + // Defines the vCenter. VCenter } @@ -239,111 +199,145 @@ type VCentersClientDeleteResponse struct { // VCentersClientGetResponse contains the response from method VCentersClient.Get. type VCentersClientGetResponse struct { + // Defines the vCenter. VCenter } // VCentersClientListByResourceGroupResponse contains the response from method VCentersClient.NewListByResourceGroupPager. type VCentersClientListByResourceGroupResponse struct { + // List of VCenters. VCentersList } // VCentersClientListResponse contains the response from method VCentersClient.NewListPager. type VCentersClientListResponse struct { + // List of VCenters. VCentersList } // VCentersClientUpdateResponse contains the response from method VCentersClient.Update. type VCentersClientUpdateResponse struct { + // Defines the vCenter. VCenter } -// VirtualMachineTemplatesClientCreateResponse contains the response from method VirtualMachineTemplatesClient.BeginCreate. -type VirtualMachineTemplatesClientCreateResponse struct { - VirtualMachineTemplate +// VMInstanceGuestAgentsClientCreateResponse contains the response from method VMInstanceGuestAgentsClient.BeginCreate. +type VMInstanceGuestAgentsClientCreateResponse struct { + // Defines the GuestAgent. + GuestAgent } -// VirtualMachineTemplatesClientDeleteResponse contains the response from method VirtualMachineTemplatesClient.BeginDelete. -type VirtualMachineTemplatesClientDeleteResponse struct { +// VMInstanceGuestAgentsClientDeleteResponse contains the response from method VMInstanceGuestAgentsClient.BeginDelete. +type VMInstanceGuestAgentsClientDeleteResponse struct { // placeholder for future response values } -// VirtualMachineTemplatesClientGetResponse contains the response from method VirtualMachineTemplatesClient.Get. -type VirtualMachineTemplatesClientGetResponse struct { - VirtualMachineTemplate +// VMInstanceGuestAgentsClientGetResponse contains the response from method VMInstanceGuestAgentsClient.Get. +type VMInstanceGuestAgentsClientGetResponse struct { + // Defines the GuestAgent. + GuestAgent } -// VirtualMachineTemplatesClientListByResourceGroupResponse contains the response from method VirtualMachineTemplatesClient.NewListByResourceGroupPager. -type VirtualMachineTemplatesClientListByResourceGroupResponse struct { - VirtualMachineTemplatesList +// VMInstanceGuestAgentsClientListResponse contains the response from method VMInstanceGuestAgentsClient.NewListPager. +type VMInstanceGuestAgentsClientListResponse struct { + // List of GuestAgent. + GuestAgentList } -// VirtualMachineTemplatesClientListResponse contains the response from method VirtualMachineTemplatesClient.NewListPager. -type VirtualMachineTemplatesClientListResponse struct { - VirtualMachineTemplatesList +// VMInstanceHybridIdentityMetadataClientGetResponse contains the response from method VMInstanceHybridIdentityMetadataClient.Get. +type VMInstanceHybridIdentityMetadataClientGetResponse struct { + // Defines the HybridIdentityMetadata. + VMInstanceHybridIdentityMetadata } -// VirtualMachineTemplatesClientUpdateResponse contains the response from method VirtualMachineTemplatesClient.Update. -type VirtualMachineTemplatesClientUpdateResponse struct { - VirtualMachineTemplate +// VMInstanceHybridIdentityMetadataClientListResponse contains the response from method VMInstanceHybridIdentityMetadataClient.NewListPager. +type VMInstanceHybridIdentityMetadataClientListResponse struct { + // List of HybridIdentityMetadata. + VMInstanceHybridIdentityMetadataList +} + +// VirtualMachineInstancesClientCreateOrUpdateResponse contains the response from method VirtualMachineInstancesClient.BeginCreateOrUpdate. +type VirtualMachineInstancesClientCreateOrUpdateResponse struct { + // Define the virtualMachineInstance. + VirtualMachineInstance +} + +// VirtualMachineInstancesClientDeleteResponse contains the response from method VirtualMachineInstancesClient.BeginDelete. +type VirtualMachineInstancesClientDeleteResponse struct { + // placeholder for future response values } -// VirtualMachinesClientAssessPatchesResponse contains the response from method VirtualMachinesClient.BeginAssessPatches. -type VirtualMachinesClientAssessPatchesResponse struct { - VirtualMachineAssessPatchesResult +// VirtualMachineInstancesClientGetResponse contains the response from method VirtualMachineInstancesClient.Get. +type VirtualMachineInstancesClientGetResponse struct { + // Define the virtualMachineInstance. + VirtualMachineInstance } -// VirtualMachinesClientCreateResponse contains the response from method VirtualMachinesClient.BeginCreate. -type VirtualMachinesClientCreateResponse struct { - VirtualMachine +// VirtualMachineInstancesClientListResponse contains the response from method VirtualMachineInstancesClient.NewListPager. +type VirtualMachineInstancesClientListResponse struct { + // List of VirtualMachineInstances. + VirtualMachineInstancesList } -// VirtualMachinesClientDeleteResponse contains the response from method VirtualMachinesClient.BeginDelete. -type VirtualMachinesClientDeleteResponse struct { +// VirtualMachineInstancesClientRestartResponse contains the response from method VirtualMachineInstancesClient.BeginRestart. +type VirtualMachineInstancesClientRestartResponse struct { // placeholder for future response values } -// VirtualMachinesClientGetResponse contains the response from method VirtualMachinesClient.Get. -type VirtualMachinesClientGetResponse struct { - VirtualMachine +// VirtualMachineInstancesClientStartResponse contains the response from method VirtualMachineInstancesClient.BeginStart. +type VirtualMachineInstancesClientStartResponse struct { + // placeholder for future response values } -// VirtualMachinesClientInstallPatchesResponse contains the response from method VirtualMachinesClient.BeginInstallPatches. -type VirtualMachinesClientInstallPatchesResponse struct { - VirtualMachineInstallPatchesResult +// VirtualMachineInstancesClientStopResponse contains the response from method VirtualMachineInstancesClient.BeginStop. +type VirtualMachineInstancesClientStopResponse struct { + // placeholder for future response values } -// VirtualMachinesClientListByResourceGroupResponse contains the response from method VirtualMachinesClient.NewListByResourceGroupPager. -type VirtualMachinesClientListByResourceGroupResponse struct { - VirtualMachinesList +// VirtualMachineInstancesClientUpdateResponse contains the response from method VirtualMachineInstancesClient.BeginUpdate. +type VirtualMachineInstancesClientUpdateResponse struct { + // Define the virtualMachineInstance. + VirtualMachineInstance } -// VirtualMachinesClientListResponse contains the response from method VirtualMachinesClient.NewListPager. -type VirtualMachinesClientListResponse struct { - VirtualMachinesList +// VirtualMachineTemplatesClientCreateResponse contains the response from method VirtualMachineTemplatesClient.BeginCreate. +type VirtualMachineTemplatesClientCreateResponse struct { + // Define the virtualMachineTemplate. + VirtualMachineTemplate } -// VirtualMachinesClientRestartResponse contains the response from method VirtualMachinesClient.BeginRestart. -type VirtualMachinesClientRestartResponse struct { +// VirtualMachineTemplatesClientDeleteResponse contains the response from method VirtualMachineTemplatesClient.BeginDelete. +type VirtualMachineTemplatesClientDeleteResponse struct { // placeholder for future response values } -// VirtualMachinesClientStartResponse contains the response from method VirtualMachinesClient.BeginStart. -type VirtualMachinesClientStartResponse struct { - // placeholder for future response values +// VirtualMachineTemplatesClientGetResponse contains the response from method VirtualMachineTemplatesClient.Get. +type VirtualMachineTemplatesClientGetResponse struct { + // Define the virtualMachineTemplate. + VirtualMachineTemplate } -// VirtualMachinesClientStopResponse contains the response from method VirtualMachinesClient.BeginStop. -type VirtualMachinesClientStopResponse struct { - // placeholder for future response values +// VirtualMachineTemplatesClientListByResourceGroupResponse contains the response from method VirtualMachineTemplatesClient.NewListByResourceGroupPager. +type VirtualMachineTemplatesClientListByResourceGroupResponse struct { + // List of VirtualMachineTemplates. + VirtualMachineTemplatesList +} + +// VirtualMachineTemplatesClientListResponse contains the response from method VirtualMachineTemplatesClient.NewListPager. +type VirtualMachineTemplatesClientListResponse struct { + // List of VirtualMachineTemplates. + VirtualMachineTemplatesList } -// VirtualMachinesClientUpdateResponse contains the response from method VirtualMachinesClient.BeginUpdate. -type VirtualMachinesClientUpdateResponse struct { - VirtualMachine +// VirtualMachineTemplatesClientUpdateResponse contains the response from method VirtualMachineTemplatesClient.Update. +type VirtualMachineTemplatesClientUpdateResponse struct { + // Define the virtualMachineTemplate. + VirtualMachineTemplate } // VirtualNetworksClientCreateResponse contains the response from method VirtualNetworksClient.BeginCreate. type VirtualNetworksClientCreateResponse struct { + // Define the virtualNetwork. VirtualNetwork } @@ -354,20 +348,24 @@ type VirtualNetworksClientDeleteResponse struct { // VirtualNetworksClientGetResponse contains the response from method VirtualNetworksClient.Get. type VirtualNetworksClientGetResponse struct { + // Define the virtualNetwork. VirtualNetwork } // VirtualNetworksClientListByResourceGroupResponse contains the response from method VirtualNetworksClient.NewListByResourceGroupPager. type VirtualNetworksClientListByResourceGroupResponse struct { + // List of VirtualNetworks. VirtualNetworksList } // VirtualNetworksClientListResponse contains the response from method VirtualNetworksClient.NewListPager. type VirtualNetworksClientListResponse struct { + // List of VirtualNetworks. VirtualNetworksList } // VirtualNetworksClientUpdateResponse contains the response from method VirtualNetworksClient.Update. type VirtualNetworksClientUpdateResponse struct { + // Define the virtualNetwork. VirtualNetwork } diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/time_rfc3339.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/time_rfc3339.go index 6cfa8035aab1..2440c0beec07 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/time_rfc3339.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/time_rfc3339.go @@ -13,7 +13,7 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/vcenters_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/vcenters_client.go index 585a1529cac9..7d738c1273bf 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/vcenters_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/vcenters_client.go @@ -13,7 +13,7 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware @@ -56,7 +56,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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - vcenterName - Name of the vCenter. // - body - Request payload. @@ -67,9 +67,10 @@ func (client *VCentersClient) BeginCreate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VCentersClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VCentersClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VCentersClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -78,20 +79,22 @@ 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 2023-10-01 func (client *VCentersClient) create(ctx context.Context, resourceGroupName string, vcenterName string, body VCenter, options *VCentersClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, vcenterName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -114,16 +117,19 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - vcenterName - Name of the vCenter. // - options - VCentersClientBeginDeleteOptions contains the optional parameters for the VCentersClient.BeginDelete method. @@ -133,7 +139,8 @@ func (client *VCentersClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[VCentersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[VCentersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[VCentersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -142,20 +149,22 @@ 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 2023-10-01 func (client *VCentersClient) deleteOperation(ctx context.Context, resourceGroupName string, vcenterName string, options *VCentersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, vcenterName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -178,7 +187,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", "2023-10-01") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -190,23 +199,26 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - vcenterName - Name of the vCenter. // - options - VCentersClientGetOptions contains the optional parameters for the VCentersClient.Get method. func (client *VCentersClient) Get(ctx context.Context, resourceGroupName string, vcenterName string, options *VCentersClientGetOptions) (VCentersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vcenterName, options) if err != nil { return VCentersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VCentersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VCentersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VCentersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -229,7 +241,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -246,7 +258,7 @@ func (client *VCentersClient) getHandleResponse(resp *http.Response) (VCentersCl // NewListPager - List of vCenters in a subscription. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - options - VCentersClientListOptions contains the optional parameters for the VCentersClient.NewListPager method. func (client *VCentersClient) NewListPager(options *VCentersClientListOptions) *runtime.Pager[VCentersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[VCentersClientListResponse]{ @@ -288,7 +300,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -305,7 +317,7 @@ func (client *VCentersClient) listHandleResponse(resp *http.Response) (VCentersC // NewListByResourceGroupPager - List of vCenters in a resource group. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - resourceGroupName - The Resource Group Name. // - options - VCentersClientListByResourceGroupOptions contains the optional parameters for the VCentersClient.NewListByResourceGroupPager // method. @@ -353,7 +365,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -371,24 +383,27 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - vcenterName - Name of the vCenter. // - body - Resource properties to update. // - options - VCentersClientUpdateOptions contains the optional parameters for the VCentersClient.Update method. func (client *VCentersClient) Update(ctx context.Context, resourceGroupName string, vcenterName string, body ResourcePatch, options *VCentersClientUpdateOptions) (VCentersClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, vcenterName, body, options) if err != nil { return VCentersClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VCentersClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VCentersClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VCentersClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -411,10 +426,13 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. 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 db5c8b7760bc..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/vcenters_client_example_test.go +++ /dev/null @@ -1,291 +0,0 @@ -//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_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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVCentersClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VCenter = armconnectedvmware.VCenter{ - // Name: to.Ptr("ContosoVCenter"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VCenters"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VCenterProperties{ - // Credentials: &armconnectedvmware.VICredential{ - // Username: to.Ptr("tempuser"), - // }, - // Fqdn: to.Ptr("ContosoVMware.contoso.com"), - // InstanceUUID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Port: to.Ptr[int32](1234), - // ProvisioningState: to.Ptr("Succeeded"), - // Version: to.Ptr("1.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVCentersClient().Get(ctx, "testrg", "ContosoVCenter", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VCenter = armconnectedvmware.VCenter{ - // Name: to.Ptr("ContosoVCenter"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VCenters"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VCenterProperties{ - // Credentials: &armconnectedvmware.VICredential{ - // Username: to.Ptr("tempuser"), - // }, - // Fqdn: to.Ptr("ContosoVMware.contoso.com"), - // InstanceUUID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Port: to.Ptr[int32](1234), - // ProvisioningState: to.Ptr("Succeeded"), - // Version: to.Ptr("1.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVCentersClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VCenter = armconnectedvmware.VCenter{ - // Name: to.Ptr("ContosoVCenter"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VCenters"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VCenterProperties{ - // Credentials: &armconnectedvmware.VICredential{ - // Username: to.Ptr("tempuser"), - // }, - // Fqdn: to.Ptr("ContosoVMware.contoso.com"), - // InstanceUUID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Port: to.Ptr[int32](1234), - // ProvisioningState: to.Ptr("Succeeded"), - // Version: to.Ptr("1.0"), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVCentersClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVCentersClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VCentersList = armconnectedvmware.VCentersList{ - // Value: []*armconnectedvmware.VCenter{ - // { - // Name: to.Ptr("ContosoVCenter"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VCenters"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VCenterProperties{ - // Credentials: &armconnectedvmware.VICredential{ - // Username: to.Ptr("tempuser"), - // }, - // Fqdn: to.Ptr("ContosoVMware.contoso.com"), - // InstanceUUID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Port: to.Ptr[int32](1234), - // ProvisioningState: to.Ptr("Succeeded"), - // Version: to.Ptr("1.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVCentersClient().NewListByResourceGroupPager("testrg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VCentersList = armconnectedvmware.VCentersList{ - // Value: []*armconnectedvmware.VCenter{ - // { - // Name: to.Ptr("ContosoVCenter"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VCenters"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VCenterProperties{ - // Credentials: &armconnectedvmware.VICredential{ - // Username: to.Ptr("tempuser"), - // }, - // Fqdn: to.Ptr("ContosoVMware.contoso.com"), - // InstanceUUID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Port: to.Ptr[int32](1234), - // ProvisioningState: to.Ptr("Succeeded"), - // Version: to.Ptr("1.0"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachineinstances_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachineinstances_client.go new file mode 100644 index 000000000000..4fc6844059fd --- /dev/null +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachineinstances_client.go @@ -0,0 +1,526 @@ +//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. +// Code generated by @autorest/go. DO NOT EDIT. + +package armconnectedvmware + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strconv" + "strings" +) + +// VirtualMachineInstancesClient contains the methods for the VirtualMachineInstances group. +// Don't use this type directly, use NewVirtualMachineInstancesClient() instead. +type VirtualMachineInstancesClient struct { + internal *arm.Client +} + +// NewVirtualMachineInstancesClient creates a new instance of VirtualMachineInstancesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVirtualMachineInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineInstancesClient, error) { + cl, err := arm.NewClient(moduleName+".VirtualMachineInstancesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineInstancesClient{ + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a virtual machine instance. Please note some properties can be +// set only during virtual machine instance creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - body - Request payload. +// - options - VirtualMachineInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginCreateOrUpdate +// method. +func (client *VirtualMachineInstancesClient) BeginCreateOrUpdate(ctx context.Context, resourceURI string, body VirtualMachineInstance, options *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachineInstancesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceURI, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineInstancesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineInstancesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - The operation to create or update a virtual machine instance. Please note some properties can be set only +// during virtual machine instance creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *VirtualMachineInstancesClient) createOrUpdate(ctx context.Context, resourceURI string, body VirtualMachineInstance, options *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceURI, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualMachineInstancesClient) createOrUpdateCreateRequest(ctx context.Context, resourceURI string, body VirtualMachineInstance, options *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete a virtual machine instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - VirtualMachineInstancesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginDelete +// method. +func (client *VirtualMachineInstancesClient) BeginDelete(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginDeleteOptions) (*runtime.Poller[VirtualMachineInstancesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineInstancesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineInstancesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - The operation to delete a virtual machine instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *VirtualMachineInstancesClient) deleteOperation(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceURI, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualMachineInstancesClient) deleteCreateRequest(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + if options != nil && options.DeleteFromHost != nil { + reqQP.Set("deleteFromHost", strconv.FormatBool(*options.DeleteFromHost)) + } + 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 +} + +// Get - Retrieves information about a virtual machine instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - VirtualMachineInstancesClientGetOptions contains the optional parameters for the VirtualMachineInstancesClient.Get +// method. +func (client *VirtualMachineInstancesClient) Get(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientGetOptions) (VirtualMachineInstancesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceURI, options) + if err != nil { + return VirtualMachineInstancesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineInstancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineInstancesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VirtualMachineInstancesClient) getCreateRequest(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualMachineInstancesClient) getHandleResponse(resp *http.Response) (VirtualMachineInstancesClientGetResponse, error) { + result := VirtualMachineInstancesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineInstance); err != nil { + return VirtualMachineInstancesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all of the virtual machine instances within the specified parent resource. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - VirtualMachineInstancesClientListOptions contains the optional parameters for the VirtualMachineInstancesClient.NewListPager +// method. +func (client *VirtualMachineInstancesClient) NewListPager(resourceURI string, options *VirtualMachineInstancesClientListOptions) *runtime.Pager[VirtualMachineInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachineInstancesClientListResponse]{ + More: func(page VirtualMachineInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachineInstancesClientListResponse) (VirtualMachineInstancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceURI, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineInstancesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineInstancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineInstancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualMachineInstancesClient) listCreateRequest(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualMachineInstancesClient) listHandleResponse(resp *http.Response) (VirtualMachineInstancesClientListResponse, error) { + result := VirtualMachineInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineInstancesList); err != nil { + return VirtualMachineInstancesClientListResponse{}, err + } + return result, nil +} + +// BeginRestart - The operation to restart a virtual machine instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - VirtualMachineInstancesClientBeginRestartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginRestart +// method. +func (client *VirtualMachineInstancesClient) BeginRestart(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginRestartOptions) (*runtime.Poller[VirtualMachineInstancesClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineInstancesClientRestartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineInstancesClientRestartResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Restart - The operation to restart a virtual machine instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *VirtualMachineInstancesClient) restart(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginRestartOptions) (*http.Response, error) { + var err error + req, err := client.restartCreateRequest(ctx, resourceURI, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *VirtualMachineInstancesClient) restartCreateRequest(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/restart" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStart - The operation to start a virtual machine instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - VirtualMachineInstancesClientBeginStartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginStart +// method. +func (client *VirtualMachineInstancesClient) BeginStart(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStartOptions) (*runtime.Poller[VirtualMachineInstancesClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineInstancesClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineInstancesClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Start - The operation to start a virtual machine instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *VirtualMachineInstancesClient) start(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStartOptions) (*http.Response, error) { + var err error + req, err := client.startCreateRequest(ctx, resourceURI, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// startCreateRequest creates the Start request. +func (client *VirtualMachineInstancesClient) startCreateRequest(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/start" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStop - The operation to power off (stop) a virtual machine instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - VirtualMachineInstancesClientBeginStopOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginStop +// method. +func (client *VirtualMachineInstancesClient) BeginStop(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStopOptions) (*runtime.Poller[VirtualMachineInstancesClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineInstancesClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineInstancesClientStopResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Stop - The operation to power off (stop) a virtual machine instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *VirtualMachineInstancesClient) stop(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStopOptions) (*http.Response, error) { + var err error + req, err := client.stopCreateRequest(ctx, resourceURI, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *VirtualMachineInstancesClient) stopCreateRequest(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStopOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/stop" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Body != nil { + if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// BeginUpdate - The operation to update a virtual machine instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - body - Resource properties to update. +// - options - VirtualMachineInstancesClientBeginUpdateOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginUpdate +// method. +func (client *VirtualMachineInstancesClient) BeginUpdate(ctx context.Context, resourceURI string, body VirtualMachineInstanceUpdate, options *VirtualMachineInstancesClientBeginUpdateOptions) (*runtime.Poller[VirtualMachineInstancesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceURI, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineInstancesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineInstancesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - The operation to update a virtual machine instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *VirtualMachineInstancesClient) update(ctx context.Context, resourceURI string, body VirtualMachineInstanceUpdate, options *VirtualMachineInstancesClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceURI, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *VirtualMachineInstancesClient) updateCreateRequest(ctx context.Context, resourceURI string, body VirtualMachineInstanceUpdate, options *VirtualMachineInstancesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachines_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachines_client.go deleted file mode 100644 index 559fc6a1aa7e..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachines_client.go +++ /dev/null @@ -1,774 +0,0 @@ -//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" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// VirtualMachinesClient contains the methods for the VirtualMachines group. -// Don't use this type directly, use NewVirtualMachinesClient() instead. -type VirtualMachinesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewVirtualMachinesClient creates a new instance of VirtualMachinesClient 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 NewVirtualMachinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachinesClient, error) { - cl, err := arm.NewClient(moduleName+".VirtualMachinesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &VirtualMachinesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// 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 -// - resourceGroupName - The name of the resource group. -// - name - 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) { - if options == nil || options.ResumeToken == "" { - resp, err := client.assessPatches(ctx, resourceGroupName, name, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientAssessPatchesResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[VirtualMachinesClientAssessPatchesResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// 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) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// 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" - 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 name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// BeginCreate - Create Or Update virtual machine. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-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 -// method. -func (client *VirtualMachinesClient) BeginCreate(ctx context.Context, resourceGroupName string, virtualMachineName string, body VirtualMachine, options *VirtualMachinesClientBeginCreateOptions) (*runtime.Poller[VirtualMachinesClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, virtualMachineName, body, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[VirtualMachinesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - 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) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - 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) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" - 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) -} - -// BeginDelete - Implements virtual machine DELETE method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the virtual machine resource. -// - options - VirtualMachinesClientBeginDeleteOptions contains the optional parameters for the VirtualMachinesClient.BeginDelete -// method. -func (client *VirtualMachinesClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginDeleteOptions) (*runtime.Poller[VirtualMachinesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, virtualMachineName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[VirtualMachinesClientDeleteResponse](resp, client.internal.Pipeline(), nil) - } else { - return runtime.NewPollerFromResumeToken[VirtualMachinesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Implements virtual machine DELETE method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-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 { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginDeleteOptions) (*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") - } - 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - 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)) - } - if options != nil && options.Retain != nil { - reqQP.Set("retain", strconv.FormatBool(*options.Retain)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Implements virtual machine GET method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the virtual machine resource. -// - options - VirtualMachinesClientGetOptions contains the optional parameters for the VirtualMachinesClient.Get method. -func (client *VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientGetOptions) (VirtualMachinesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, virtualMachineName, options) - if err != nil { - return VirtualMachinesClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VirtualMachinesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualMachinesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientGetOptions) (*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") - } - 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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *VirtualMachinesClient) getHandleResponse(resp *http.Response) (VirtualMachinesClientGetResponse, error) { - result := VirtualMachinesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachine); err != nil { - return VirtualMachinesClientGetResponse{}, err - } - return result, nil -} - -// 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 -// - resourceGroupName - The name of the resource group. -// - name - 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) { - if options == nil || options.ResumeToken == "" { - resp, err := client.installPatches(ctx, resourceGroupName, name, installPatchesInput, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientInstallPatchesResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[VirtualMachinesClientInstallPatchesResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// 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) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// 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" - 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 name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-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. -// -// Generated from API version 2022-01-10-preview -// - options - VirtualMachinesClientListOptions contains the optional parameters for the VirtualMachinesClient.NewListPager -// method. -func (client *VirtualMachinesClient) NewListPager(options *VirtualMachinesClientListOptions) *runtime.Pager[VirtualMachinesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[VirtualMachinesClientListResponse]{ - More: func(page VirtualMachinesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *VirtualMachinesClientListResponse) (VirtualMachinesClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return VirtualMachinesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VirtualMachinesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualMachinesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, options *VirtualMachinesClientListOptions) (*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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *VirtualMachinesClient) listHandleResponse(resp *http.Response) (VirtualMachinesClientListResponse, error) { - result := VirtualMachinesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachinesList); err != nil { - return VirtualMachinesClientListResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - List of virtualMachines in a resource group. -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - options - VirtualMachinesClientListByResourceGroupOptions contains the optional parameters for the VirtualMachinesClient.NewListByResourceGroupPager -// method. -func (client *VirtualMachinesClient) NewListByResourceGroupPager(resourceGroupName string, options *VirtualMachinesClientListByResourceGroupOptions) *runtime.Pager[VirtualMachinesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[VirtualMachinesClientListByResourceGroupResponse]{ - More: func(page VirtualMachinesClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *VirtualMachinesClientListByResourceGroupResponse) (VirtualMachinesClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return VirtualMachinesClientListByResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VirtualMachinesClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualMachinesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(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" - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-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{} - if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachinesList); err != nil { - return VirtualMachinesClientListByResourceGroupResponse{}, 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 -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the virtual machine resource. -// - options - VirtualMachinesClientBeginRestartOptions contains the optional parameters for the VirtualMachinesClient.BeginRestart -// method. -func (client *VirtualMachinesClient) BeginRestart(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginRestartOptions) (*runtime.Poller[VirtualMachinesClientRestartResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.restart(ctx, resourceGroupName, virtualMachineName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[VirtualMachinesClientRestartResponse](resp, client.internal.Pipeline(), nil) - } else { - return runtime.NewPollerFromResumeToken[VirtualMachinesClientRestartResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Restart - Restart virtual machine. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-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 { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// restartCreateRequest creates the Restart request. -func (client *VirtualMachinesClient) restartCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginRestartOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/restart" - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// BeginStart - Start virtual machine. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the virtual machine resource. -// - options - VirtualMachinesClientBeginStartOptions contains the optional parameters for the VirtualMachinesClient.BeginStart -// method. -func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginStartOptions) (*runtime.Poller[VirtualMachinesClientStartResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.start(ctx, resourceGroupName, virtualMachineName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[VirtualMachinesClientStartResponse](resp, client.internal.Pipeline(), nil) - } else { - return runtime.NewPollerFromResumeToken[VirtualMachinesClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Start - Start virtual machine. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-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 { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// startCreateRequest creates the Start request. -func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginStartOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/start" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// BeginStop - Stop virtual machine. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-preview -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the virtual machine resource. -// - options - VirtualMachinesClientBeginStopOptions contains the optional parameters for the VirtualMachinesClient.BeginStop -// method. -func (client *VirtualMachinesClient) BeginStop(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginStopOptions) (*runtime.Poller[VirtualMachinesClientStopResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.stop(ctx, resourceGroupName, virtualMachineName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[VirtualMachinesClientStopResponse](resp, client.internal.Pipeline(), nil) - } else { - return runtime.NewPollerFromResumeToken[VirtualMachinesClientStopResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Stop - Stop virtual machine. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-10-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 { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// stopCreateRequest creates the Stop request. -func (client *VirtualMachinesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginStopOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/stop" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - return req, runtime.MarshalAsJSON(req, *options.Body) - } - return req, nil -} - -// 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 -// - resourceGroupName - The Resource Group Name. -// - virtualMachineName - Name of the virtual machine resource. -// - body - Resource properties to update. -// - options - VirtualMachinesClientBeginUpdateOptions contains the optional parameters for the VirtualMachinesClient.BeginUpdate -// method. -func (client *VirtualMachinesClient) BeginUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, body VirtualMachineUpdate, options *VirtualMachinesClientBeginUpdateOptions) (*runtime.Poller[VirtualMachinesClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, virtualMachineName, body, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[VirtualMachinesClientUpdateResponse](resp, client.internal.Pipeline(), nil) - } else { - return runtime.NewPollerFromResumeToken[VirtualMachinesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// 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 -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 { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// updateCreateRequest creates the Update request. -func (client *VirtualMachinesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, body VirtualMachineUpdate, options *VirtualMachinesClientBeginUpdateOptions) (*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") - } - 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-10-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 80a297d6b962..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachines_client_example_test.go +++ /dev/null @@ -1,482 +0,0 @@ -//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_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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineAssessPatchesResult = armconnectedvmware.VirtualMachineAssessPatchesResult{ - // AssessmentActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // AvailablePatchCountByClassification: &armconnectedvmware.AvailablePatchCountByClassification{ - // Critical: to.Ptr[int32](0), - // Definition: to.Ptr[int32](0), - // FeaturePack: to.Ptr[int32](0), - // Security: to.Ptr[int32](0), - // ServicePack: to.Ptr[int32](0), - // Tools: to.Ptr[int32](0), - // UpdateRollup: to.Ptr[int32](1), - // Updates: to.Ptr[int32](1), - // }, - // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-15T02:16:06.9740000Z"); return t}()), - // OSType: to.Ptr(armconnectedvmware.OsTypeUMWindows), - // RebootPending: to.Ptr(true), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-15T02:15:20.9340000Z"); return t}()), - // StartedBy: to.Ptr(armconnectedvmware.PatchOperationStartedByUser), - // Status: to.Ptr(armconnectedvmware.PatchOperationStatusSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstallPatchesResult = armconnectedvmware.VirtualMachineInstallPatchesResult{ - // ExcludedPatchCount: to.Ptr[int32](0), - // FailedPatchCount: to.Ptr[int32](0), - // InstallationActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // InstalledPatchCount: to.Ptr[int32](3), - // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-15T02:16:06.9740000Z"); return t}()), - // MaintenanceWindowExceeded: to.Ptr(false), - // NotSelectedPatchCount: to.Ptr[int32](0), - // OSType: to.Ptr(armconnectedvmware.OsTypeUMWindows), - // PendingPatchCount: to.Ptr[int32](2), - // RebootStatus: to.Ptr(armconnectedvmware.VMGuestPatchRebootStatusCompleted), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-15T02:15:06.9740000Z"); return t}()), - // StartedBy: to.Ptr(armconnectedvmware.PatchOperationStartedByUser), - // Status: to.Ptr(armconnectedvmware.PatchOperationStatusSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armconnectedvmware.VirtualMachine{ - // Name: to.Ptr("DemoVM"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachines"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualMachines/DemoVM"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualMachineProperties{ - // HardwareProfile: &armconnectedvmware.HardwareProfile{ - // MemorySizeMB: to.Ptr[int32](4196), - // NumCPUs: to.Ptr[int32](4), - // }, - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // OSProfile: &armconnectedvmware.OsProfile{ - // ComputerName: to.Ptr("DemoVM"), - // OSType: to.Ptr(armconnectedvmware.OsTypeWindows), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "testrg", "DemoVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armconnectedvmware.VirtualMachine{ - // Name: to.Ptr("DemoVM"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachines"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualMachines/DemoVM"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualMachineProperties{ - // HardwareProfile: &armconnectedvmware.HardwareProfile{ - // MemorySizeMB: to.Ptr[int32](4196), - // NumCPUs: to.Ptr[int32](4), - // }, - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // OSProfile: &armconnectedvmware.OsProfile{ - // ComputerName: to.Ptr("DemoVM"), - // OSType: to.Ptr(armconnectedvmware.OsTypeWindows), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armconnectedvmware.VirtualMachine{ - // Name: to.Ptr("DemoVM"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachines"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualMachines/DemoVM"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualMachineProperties{ - // HardwareProfile: &armconnectedvmware.HardwareProfile{ - // MemorySizeMB: to.Ptr[int32](4196), - // NumCPUs: to.Ptr[int32](4), - // }, - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // OSProfile: &armconnectedvmware.OsProfile{ - // ComputerName: to.Ptr("DemoVM"), - // OSType: to.Ptr(armconnectedvmware.OsTypeWindows), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachinesList = armconnectedvmware.VirtualMachinesList{ - // Value: []*armconnectedvmware.VirtualMachine{ - // { - // Name: to.Ptr("DemoVM"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachines"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualMachines/DemoVM"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualMachineProperties{ - // HardwareProfile: &armconnectedvmware.HardwareProfile{ - // MemorySizeMB: to.Ptr[int32](4196), - // NumCPUs: to.Ptr[int32](4), - // }, - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // OSProfile: &armconnectedvmware.OsProfile{ - // ComputerName: to.Ptr("DemoVM"), - // OSType: to.Ptr(armconnectedvmware.OsTypeWindows), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListByResourceGroupPager("testrg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachinesList = armconnectedvmware.VirtualMachinesList{ - // Value: []*armconnectedvmware.VirtualMachine{ - // { - // Name: to.Ptr("DemoVM"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachines"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualMachines/DemoVM"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualMachineProperties{ - // HardwareProfile: &armconnectedvmware.HardwareProfile{ - // MemorySizeMB: to.Ptr[int32](4196), - // NumCPUs: to.Ptr[int32](4), - // }, - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // OSProfile: &armconnectedvmware.OsProfile{ - // ComputerName: to.Ptr("DemoVM"), - // OSType: to.Ptr(armconnectedvmware.OsTypeWindows), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachinetemplates_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachinetemplates_client.go index 68c3fff50fca..8dc85bc63bfc 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachinetemplates_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachinetemplates_client.go @@ -13,7 +13,7 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware @@ -56,7 +56,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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - virtualMachineTemplateName - Name of the virtual machine template resource. // - body - Request payload. @@ -68,9 +68,10 @@ func (client *VirtualMachineTemplatesClient) BeginCreate(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineTemplatesClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineTemplatesClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualMachineTemplatesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -79,20 +80,22 @@ 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 2023-10-01 func (client *VirtualMachineTemplatesClient) create(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, body VirtualMachineTemplate, options *VirtualMachineTemplatesClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, virtualMachineTemplateName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -115,16 +118,19 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - virtualMachineTemplateName - Name of the virtual machine template resource. // - options - VirtualMachineTemplatesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineTemplatesClient.BeginDelete @@ -135,7 +141,8 @@ func (client *VirtualMachineTemplatesClient) BeginDelete(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[VirtualMachineTemplatesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[VirtualMachineTemplatesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualMachineTemplatesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -144,20 +151,22 @@ 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 2023-10-01 func (client *VirtualMachineTemplatesClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, options *VirtualMachineTemplatesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualMachineTemplateName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -180,7 +189,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", "2023-10-01") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -192,24 +201,27 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - virtualMachineTemplateName - Name of the virtual machine template resource. // - options - VirtualMachineTemplatesClientGetOptions contains the optional parameters for the VirtualMachineTemplatesClient.Get // method. func (client *VirtualMachineTemplatesClient) Get(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, options *VirtualMachineTemplatesClientGetOptions) (VirtualMachineTemplatesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, virtualMachineTemplateName, options) if err != nil { return VirtualMachineTemplatesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VirtualMachineTemplatesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualMachineTemplatesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineTemplatesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -232,7 +244,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +261,7 @@ func (client *VirtualMachineTemplatesClient) getHandleResponse(resp *http.Respon // NewListPager - List of virtualMachineTemplates in a subscription. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - options - VirtualMachineTemplatesClientListOptions contains the optional parameters for the VirtualMachineTemplatesClient.NewListPager // method. func (client *VirtualMachineTemplatesClient) NewListPager(options *VirtualMachineTemplatesClientListOptions) *runtime.Pager[VirtualMachineTemplatesClientListResponse] { @@ -292,7 +304,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -309,7 +321,7 @@ func (client *VirtualMachineTemplatesClient) listHandleResponse(resp *http.Respo // NewListByResourceGroupPager - List of virtualMachineTemplates in a resource group. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - resourceGroupName - The Resource Group Name. // - options - VirtualMachineTemplatesClientListByResourceGroupOptions contains the optional parameters for the VirtualMachineTemplatesClient.NewListByResourceGroupPager // method. @@ -357,7 +369,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -375,25 +387,28 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - virtualMachineTemplateName - Name of the virtual machine template resource. // - body - Resource properties to update. // - options - VirtualMachineTemplatesClientUpdateOptions contains the optional parameters for the VirtualMachineTemplatesClient.Update // method. func (client *VirtualMachineTemplatesClient) Update(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, body ResourcePatch, options *VirtualMachineTemplatesClientUpdateOptions) (VirtualMachineTemplatesClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, virtualMachineTemplateName, body, options) if err != nil { return VirtualMachineTemplatesClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VirtualMachineTemplatesClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualMachineTemplatesClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineTemplatesClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -416,10 +431,13 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. 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 a2eb361f92ce..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualmachinetemplates_client_example_test.go +++ /dev/null @@ -1,262 +0,0 @@ -//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_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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineTemplatesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineTemplate = armconnectedvmware.VirtualMachineTemplate{ - // Name: to.Ptr("WebFrontEndTemplate"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachineTemplates"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualMachineTemplates/WebFrontEndTemplate"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualMachineTemplateProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineTemplatesClient().Get(ctx, "testrg", "WebFrontEndTemplate", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineTemplate = armconnectedvmware.VirtualMachineTemplate{ - // Name: to.Ptr("WebFrontEndTemplate"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachineTemplates"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualMachineTemplates/WebFrontEndTemplate"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualMachineTemplateProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineTemplatesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineTemplate = armconnectedvmware.VirtualMachineTemplate{ - // Name: to.Ptr("WebFrontEndTemplate"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachineTemplates"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualMachineTemplates/WebFrontEndTemplate"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualMachineTemplateProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineTemplatesClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineTemplatesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineTemplatesList = armconnectedvmware.VirtualMachineTemplatesList{ - // Value: []*armconnectedvmware.VirtualMachineTemplate{ - // { - // Name: to.Ptr("WebFrontEndTemplate"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachineTemplates"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualMachineTemplates/WebFrontEndTemplate"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualMachineTemplateProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineTemplatesClient().NewListByResourceGroupPager("testrg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineTemplatesList = armconnectedvmware.VirtualMachineTemplatesList{ - // Value: []*armconnectedvmware.VirtualMachineTemplate{ - // { - // Name: to.Ptr("WebFrontEndTemplate"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualMachineTemplates"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualMachineTemplates/WebFrontEndTemplate"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualMachineTemplateProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualnetworks_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualnetworks_client.go index 2a5a458829db..e91e01b1ca96 100644 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualnetworks_client.go +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualnetworks_client.go @@ -13,7 +13,7 @@ // 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. +// Code generated by @autorest/go. DO NOT EDIT. package armconnectedvmware @@ -56,7 +56,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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - virtualNetworkName - Name of the virtual network resource. // - body - Request payload. @@ -68,9 +68,10 @@ func (client *VirtualNetworksClient) BeginCreate(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualNetworksClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -79,20 +80,22 @@ 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 2023-10-01 func (client *VirtualNetworksClient) create(ctx context.Context, resourceGroupName string, virtualNetworkName string, body VirtualNetwork, options *VirtualNetworksClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, virtualNetworkName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -115,16 +118,19 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - virtualNetworkName - Name of the virtual network resource. // - options - VirtualNetworksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworksClient.BeginDelete @@ -135,7 +141,8 @@ func (client *VirtualNetworksClient) BeginDelete(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller[VirtualNetworksClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[VirtualNetworksClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualNetworksClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -144,20 +151,22 @@ 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 2023-10-01 func (client *VirtualNetworksClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -180,7 +189,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", "2023-10-01") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -192,23 +201,26 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - virtualNetworkName - Name of the virtual network resource. // - options - VirtualNetworksClientGetOptions contains the optional parameters for the VirtualNetworksClient.Get method. func (client *VirtualNetworksClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientGetOptions) (VirtualNetworksClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) if err != nil { return VirtualNetworksClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VirtualNetworksClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualNetworksClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworksClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -231,7 +243,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +260,7 @@ func (client *VirtualNetworksClient) getHandleResponse(resp *http.Response) (Vir // NewListPager - List of virtualNetworks in a subscription. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - options - VirtualNetworksClientListOptions contains the optional parameters for the VirtualNetworksClient.NewListPager // method. func (client *VirtualNetworksClient) NewListPager(options *VirtualNetworksClientListOptions) *runtime.Pager[VirtualNetworksClientListResponse] { @@ -291,7 +303,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -308,7 +320,7 @@ func (client *VirtualNetworksClient) listHandleResponse(resp *http.Response) (Vi // NewListByResourceGroupPager - List of virtualNetworks in a resource group. // -// Generated from API version 2022-01-10-preview +// Generated from API version 2023-10-01 // - resourceGroupName - The Resource Group Name. // - options - VirtualNetworksClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworksClient.NewListByResourceGroupPager // method. @@ -356,7 +368,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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -374,24 +386,27 @@ 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 2023-10-01 // - resourceGroupName - The Resource Group Name. // - virtualNetworkName - Name of the virtual network resource. // - body - Resource properties to update. // - options - VirtualNetworksClientUpdateOptions contains the optional parameters for the VirtualNetworksClient.Update method. func (client *VirtualNetworksClient) Update(ctx context.Context, resourceGroupName string, virtualNetworkName string, body ResourcePatch, options *VirtualNetworksClientUpdateOptions) (VirtualNetworksClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, virtualNetworkName, body, options) if err != nil { return VirtualNetworksClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VirtualNetworksClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualNetworksClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworksClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -414,10 +429,13 @@ 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", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. 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 0b86165719d3..000000000000 --- a/sdk/resourcemanager/connectedvmware/armconnectedvmware/virtualnetworks_client_example_test.go +++ /dev/null @@ -1,262 +0,0 @@ -//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_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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armconnectedvmware.VirtualNetwork{ - // Name: to.Ptr("ProdNetwork"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualNetworks"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualNetworks/ProdNetwork"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualNetworkProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworksClient().Get(ctx, "testrg", "ProdNetwork", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armconnectedvmware.VirtualNetwork{ - // Name: to.Ptr("ProdNetwork"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualNetworks"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualNetworks/ProdNetwork"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualNetworkProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armconnectedvmware.VirtualNetwork{ - // Name: to.Ptr("ProdNetwork"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualNetworks"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualNetworks/ProdNetwork"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualNetworkProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().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/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworksClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworksList = armconnectedvmware.VirtualNetworksList{ - // Value: []*armconnectedvmware.VirtualNetwork{ - // { - // Name: to.Ptr("ProdNetwork"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualNetworks"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualNetworks/ProdNetwork"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualNetworkProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7473936304533e6716fc4563401bf265dda4cb64/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() - clientFactory, err := armconnectedvmware.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworksClient().NewListByResourceGroupPager("testrg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworksList = armconnectedvmware.VirtualNetworksList{ - // Value: []*armconnectedvmware.VirtualNetwork{ - // { - // Name: to.Ptr("ProdNetwork"), - // Type: to.Ptr("Microsoft.ConnectedVMwarevSphere/VirtualNetworks"), - // ExtendedLocation: &armconnectedvmware.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso"), - // Type: to.Ptr("customLocation"), - // }, - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualNetworks/ProdNetwork"), - // Location: to.Ptr("East US"), - // Properties: &armconnectedvmware.VirtualNetworkProperties{ - // MoRefID: to.Ptr("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // ProvisioningState: to.Ptr("Succeeded"), - // VCenterID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/vminstanceguestagents_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/vminstanceguestagents_client.go new file mode 100644 index 000000000000..4ee8ea04bb3e --- /dev/null +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/vminstanceguestagents_client.go @@ -0,0 +1,273 @@ +//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. +// Code generated by @autorest/go. DO NOT EDIT. + +package armconnectedvmware + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// VMInstanceGuestAgentsClient contains the methods for the VMInstanceGuestAgents group. +// Don't use this type directly, use NewVMInstanceGuestAgentsClient() instead. +type VMInstanceGuestAgentsClient struct { + internal *arm.Client +} + +// NewVMInstanceGuestAgentsClient creates a new instance of VMInstanceGuestAgentsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVMInstanceGuestAgentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*VMInstanceGuestAgentsClient, error) { + cl, err := arm.NewClient(moduleName+".VMInstanceGuestAgentsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VMInstanceGuestAgentsClient{ + internal: cl, + } + return client, nil +} + +// BeginCreate - Create Or Update GuestAgent. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - body - Request payload. +// - options - VMInstanceGuestAgentsClientBeginCreateOptions contains the optional parameters for the VMInstanceGuestAgentsClient.BeginCreate +// method. +func (client *VMInstanceGuestAgentsClient) BeginCreate(ctx context.Context, resourceURI string, body GuestAgent, options *VMInstanceGuestAgentsClientBeginCreateOptions) (*runtime.Poller[VMInstanceGuestAgentsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceURI, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VMInstanceGuestAgentsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VMInstanceGuestAgentsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Create - Create Or Update GuestAgent. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *VMInstanceGuestAgentsClient) create(ctx context.Context, resourceURI string, body GuestAgent, options *VMInstanceGuestAgentsClientBeginCreateOptions) (*http.Response, error) { + var err error + req, err := client.createCreateRequest(ctx, resourceURI, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *VMInstanceGuestAgentsClient) createCreateRequest(ctx context.Context, resourceURI string, body GuestAgent, options *VMInstanceGuestAgentsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Implements GuestAgent DELETE method. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - VMInstanceGuestAgentsClientBeginDeleteOptions contains the optional parameters for the VMInstanceGuestAgentsClient.BeginDelete +// method. +func (client *VMInstanceGuestAgentsClient) BeginDelete(ctx context.Context, resourceURI string, options *VMInstanceGuestAgentsClientBeginDeleteOptions) (*runtime.Poller[VMInstanceGuestAgentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[VMInstanceGuestAgentsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VMInstanceGuestAgentsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Implements GuestAgent DELETE method. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *VMInstanceGuestAgentsClient) deleteOperation(ctx context.Context, resourceURI string, options *VMInstanceGuestAgentsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceURI, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VMInstanceGuestAgentsClient) deleteCreateRequest(ctx context.Context, resourceURI string, options *VMInstanceGuestAgentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Implements GuestAgent GET method. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - VMInstanceGuestAgentsClientGetOptions contains the optional parameters for the VMInstanceGuestAgentsClient.Get +// method. +func (client *VMInstanceGuestAgentsClient) Get(ctx context.Context, resourceURI string, options *VMInstanceGuestAgentsClientGetOptions) (VMInstanceGuestAgentsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceURI, options) + if err != nil { + return VMInstanceGuestAgentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VMInstanceGuestAgentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VMInstanceGuestAgentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VMInstanceGuestAgentsClient) getCreateRequest(ctx context.Context, resourceURI string, options *VMInstanceGuestAgentsClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VMInstanceGuestAgentsClient) getHandleResponse(resp *http.Response) (VMInstanceGuestAgentsClientGetResponse, error) { + result := VMInstanceGuestAgentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GuestAgent); err != nil { + return VMInstanceGuestAgentsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Returns the list of GuestAgent of the given vm. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - VMInstanceGuestAgentsClientListOptions contains the optional parameters for the VMInstanceGuestAgentsClient.NewListPager +// method. +func (client *VMInstanceGuestAgentsClient) NewListPager(resourceURI string, options *VMInstanceGuestAgentsClientListOptions) *runtime.Pager[VMInstanceGuestAgentsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VMInstanceGuestAgentsClientListResponse]{ + More: func(page VMInstanceGuestAgentsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VMInstanceGuestAgentsClientListResponse) (VMInstanceGuestAgentsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceURI, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VMInstanceGuestAgentsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VMInstanceGuestAgentsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VMInstanceGuestAgentsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VMInstanceGuestAgentsClient) listCreateRequest(ctx context.Context, resourceURI string, options *VMInstanceGuestAgentsClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VMInstanceGuestAgentsClient) listHandleResponse(resp *http.Response) (VMInstanceGuestAgentsClientListResponse, error) { + result := VMInstanceGuestAgentsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GuestAgentList); err != nil { + return VMInstanceGuestAgentsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedvmware/armconnectedvmware/vminstancehybrididentitymetadata_client.go b/sdk/resourcemanager/connectedvmware/armconnectedvmware/vminstancehybrididentitymetadata_client.go new file mode 100644 index 000000000000..f4b68e9e4b85 --- /dev/null +++ b/sdk/resourcemanager/connectedvmware/armconnectedvmware/vminstancehybrididentitymetadata_client.go @@ -0,0 +1,155 @@ +//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. +// Code generated by @autorest/go. DO NOT EDIT. + +package armconnectedvmware + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// VMInstanceHybridIdentityMetadataClient contains the methods for the VMInstanceHybridIdentityMetadata group. +// Don't use this type directly, use NewVMInstanceHybridIdentityMetadataClient() instead. +type VMInstanceHybridIdentityMetadataClient struct { + internal *arm.Client +} + +// NewVMInstanceHybridIdentityMetadataClient creates a new instance of VMInstanceHybridIdentityMetadataClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVMInstanceHybridIdentityMetadataClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*VMInstanceHybridIdentityMetadataClient, error) { + cl, err := arm.NewClient(moduleName+".VMInstanceHybridIdentityMetadataClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VMInstanceHybridIdentityMetadataClient{ + internal: cl, + } + return client, nil +} + +// Get - Implements HybridIdentityMetadata GET method. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - VMInstanceHybridIdentityMetadataClientGetOptions contains the optional parameters for the VMInstanceHybridIdentityMetadataClient.Get +// method. +func (client *VMInstanceHybridIdentityMetadataClient) Get(ctx context.Context, resourceURI string, options *VMInstanceHybridIdentityMetadataClientGetOptions) (VMInstanceHybridIdentityMetadataClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceURI, options) + if err != nil { + return VMInstanceHybridIdentityMetadataClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VMInstanceHybridIdentityMetadataClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VMInstanceHybridIdentityMetadataClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VMInstanceHybridIdentityMetadataClient) getCreateRequest(ctx context.Context, resourceURI string, options *VMInstanceHybridIdentityMetadataClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata/default" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VMInstanceHybridIdentityMetadataClient) getHandleResponse(resp *http.Response) (VMInstanceHybridIdentityMetadataClientGetResponse, error) { + result := VMInstanceHybridIdentityMetadataClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VMInstanceHybridIdentityMetadata); err != nil { + return VMInstanceHybridIdentityMetadataClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Returns the list of HybridIdentityMetadata of the given vm. +// +// Generated from API version 2023-10-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - VMInstanceHybridIdentityMetadataClientListOptions contains the optional parameters for the VMInstanceHybridIdentityMetadataClient.NewListPager +// method. +func (client *VMInstanceHybridIdentityMetadataClient) NewListPager(resourceURI string, options *VMInstanceHybridIdentityMetadataClientListOptions) *runtime.Pager[VMInstanceHybridIdentityMetadataClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VMInstanceHybridIdentityMetadataClientListResponse]{ + More: func(page VMInstanceHybridIdentityMetadataClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VMInstanceHybridIdentityMetadataClientListResponse) (VMInstanceHybridIdentityMetadataClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceURI, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VMInstanceHybridIdentityMetadataClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VMInstanceHybridIdentityMetadataClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VMInstanceHybridIdentityMetadataClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VMInstanceHybridIdentityMetadataClient) listCreateRequest(ctx context.Context, resourceURI string, options *VMInstanceHybridIdentityMetadataClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VMInstanceHybridIdentityMetadataClient) listHandleResponse(resp *http.Response) (VMInstanceHybridIdentityMetadataClientListResponse, error) { + result := VMInstanceHybridIdentityMetadataClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VMInstanceHybridIdentityMetadataList); err != nil { + return VMInstanceHybridIdentityMetadataClientListResponse{}, err + } + return result, nil +}