diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md b/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md index c40d6c19337c..dd153baf82c1 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md @@ -1,5 +1,262 @@ # Release History +## 2.0.0-beta.1 (2023-10-27) +### Breaking Changes + +- `StatusConnectedRecently`, `StatusDisconnected`, `StatusError`, `StatusNotConnectedRecently`, `StatusNotYetRegistered` from enum `Status` has been removed +- Enum `ArcSettingAggregateState` has been removed +- Enum `DiagnosticLevel` has been removed +- Enum `ExtensionAggregateState` has been removed +- Enum `ImdsAttestation` has been removed +- Enum `NodeArcState` has been removed +- Enum `NodeExtensionState` has been removed +- Enum `ProvisioningState` has been removed +- Enum `WindowsServerSubscription` has been removed +- Function `NewArcSettingsClient` has been removed +- Function `*ArcSettingsClient.Create` has been removed +- Function `*ArcSettingsClient.BeginCreateIdentity` has been removed +- Function `*ArcSettingsClient.BeginDelete` has been removed +- Function `*ArcSettingsClient.GeneratePassword` has been removed +- Function `*ArcSettingsClient.Get` has been removed +- Function `*ArcSettingsClient.NewListByClusterPager` has been removed +- Function `*ArcSettingsClient.Update` has been removed +- Function `*ClientFactory.NewArcSettingsClient` has been removed +- Function `*ClientFactory.NewClustersClient` has been removed +- Function `*ClientFactory.NewExtensionsClient` has been removed +- Function `NewClustersClient` has been removed +- Function `*ClustersClient.Create` has been removed +- Function `*ClustersClient.BeginCreateIdentity` has been removed +- Function `*ClustersClient.BeginDelete` has been removed +- Function `*ClustersClient.Get` has been removed +- Function `*ClustersClient.NewListByResourceGroupPager` has been removed +- Function `*ClustersClient.NewListBySubscriptionPager` has been removed +- Function `*ClustersClient.Update` has been removed +- Function `*ClustersClient.BeginUploadCertificate` has been removed +- Function `NewExtensionsClient` has been removed +- Function `*ExtensionsClient.BeginCreate` has been removed +- Function `*ExtensionsClient.BeginDelete` has been removed +- Function `*ExtensionsClient.Get` has been removed +- Function `*ExtensionsClient.NewListByArcSettingPager` has been removed +- Function `*ExtensionsClient.BeginUpdate` has been removed +- Operation `*OperationsClient.List` has supported pagination, use `*OperationsClient.NewListPager` instead. +- Struct `ArcConnectivityProperties` has been removed +- Struct `ArcIdentityResponse` has been removed +- Struct `ArcIdentityResponseProperties` has been removed +- Struct `ArcSetting` has been removed +- Struct `ArcSettingList` has been removed +- Struct `ArcSettingProperties` has been removed +- Struct `ArcSettingsPatch` has been removed +- Struct `ArcSettingsPatchProperties` has been removed +- Struct `Cluster` has been removed +- Struct `ClusterDesiredProperties` has been removed +- Struct `ClusterIdentityResponse` has been removed +- Struct `ClusterIdentityResponseProperties` has been removed +- Struct `ClusterList` has been removed +- Struct `ClusterNode` has been removed +- Struct `ClusterPatch` has been removed +- Struct `ClusterPatchProperties` has been removed +- Struct `ClusterProperties` has been removed +- Struct `ClusterReportedProperties` has been removed +- Struct `Extension` has been removed +- Struct `ExtensionList` has been removed +- Struct `ExtensionParameters` has been removed +- Struct `ExtensionProperties` has been removed +- Struct `PasswordCredential` has been removed +- Struct `PerNodeExtensionState` has been removed +- Struct `PerNodeState` has been removed +- Struct `RawCertificateData` has been removed +- Struct `UploadCertificateRequest` has been removed + +### Features Added + +- New value `StatusFailed`, `StatusInProgress`, `StatusSucceeded` added to enum type `Status` +- New enum type `CloudInitDataSource` with values `CloudInitDataSourceAzure`, `CloudInitDataSourceNoCloud` +- New enum type `DiskFileFormat` with values `DiskFileFormatVhd`, `DiskFileFormatVhdx` +- New enum type `ExtendedLocationTypes` with values `ExtendedLocationTypesCustomLocation` +- New enum type `HyperVGeneration` with values `HyperVGenerationV1`, `HyperVGenerationV2` +- New enum type `IPAllocationMethodEnum` with values `IPAllocationMethodEnumDynamic`, `IPAllocationMethodEnumStatic` +- New enum type `IPPoolTypeEnum` with values `IPPoolTypeEnumVM`, `IPPoolTypeEnumVippool` +- New enum type `OperatingSystemTypes` with values `OperatingSystemTypesLinux`, `OperatingSystemTypesWindows` +- New enum type `PowerStateEnum` with values `PowerStateEnumDeallocated`, `PowerStateEnumDeallocating`, `PowerStateEnumRunning`, `PowerStateEnumStarting`, `PowerStateEnumStopped`, `PowerStateEnumStopping`, `PowerStateEnumUnknown` +- New enum type `ProvisioningAction` with values `ProvisioningActionInstall`, `ProvisioningActionRepair`, `ProvisioningActionUninstall` +- New enum type `ProvisioningStateEnum` with values `ProvisioningStateEnumAccepted`, `ProvisioningStateEnumCanceled`, `ProvisioningStateEnumDeleting`, `ProvisioningStateEnumFailed`, `ProvisioningStateEnumInProgress`, `ProvisioningStateEnumSucceeded` +- New enum type `SecurityTypes` with values `SecurityTypesConfidentialVM`, `SecurityTypesTrustedLaunch` +- New enum type `StatusLevelTypes` with values `StatusLevelTypesError`, `StatusLevelTypesInfo`, `StatusLevelTypesWarning` +- New enum type `StatusTypes` with values `StatusTypesFailed`, `StatusTypesInProgress`, `StatusTypesSucceeded` +- New enum type `VMSizeEnum` with values `VMSizeEnumCustom`, `VMSizeEnumDefault`, `VMSizeEnumStandardA2V2`, `VMSizeEnumStandardA4V2`, `VMSizeEnumStandardD16SV3`, `VMSizeEnumStandardD2SV3`, `VMSizeEnumStandardD32SV3`, `VMSizeEnumStandardD4SV3`, `VMSizeEnumStandardD8SV3`, `VMSizeEnumStandardDS13V2`, `VMSizeEnumStandardDS2V2`, `VMSizeEnumStandardDS3V2`, `VMSizeEnumStandardDS4V2`, `VMSizeEnumStandardDS5V2`, `VMSizeEnumStandardK8S2V1`, `VMSizeEnumStandardK8S3V1`, `VMSizeEnumStandardK8S4V1`, `VMSizeEnumStandardK8S5V1`, `VMSizeEnumStandardK8SV1`, `VMSizeEnumStandardNK12`, `VMSizeEnumStandardNK6`, `VMSizeEnumStandardNV12`, `VMSizeEnumStandardNV6` +- New function `*ClientFactory.NewGalleryImagesClient() *GalleryImagesClient` +- New function `*ClientFactory.NewGuestAgentClient() *GuestAgentClient` +- New function `*ClientFactory.NewGuestAgentsClient() *GuestAgentsClient` +- New function `*ClientFactory.NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient` +- New function `*ClientFactory.NewLogicalNetworksClient() *LogicalNetworksClient` +- New function `*ClientFactory.NewMarketplaceGalleryImagesClient() *MarketplaceGalleryImagesClient` +- New function `*ClientFactory.NewNetworkInterfacesClient() *NetworkInterfacesClient` +- New function `*ClientFactory.NewStorageContainersClient() *StorageContainersClient` +- New function `*ClientFactory.NewVirtualHardDisksClient() *VirtualHardDisksClient` +- New function `*ClientFactory.NewVirtualMachineInstancesClient() *VirtualMachineInstancesClient` +- New function `NewGalleryImagesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GalleryImagesClient, error)` +- New function `*GalleryImagesClient.BeginCreateOrUpdate(context.Context, string, string, GalleryImages, *GalleryImagesClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryImagesClientCreateOrUpdateResponse], error)` +- New function `*GalleryImagesClient.BeginDelete(context.Context, string, string, *GalleryImagesClientBeginDeleteOptions) (*runtime.Poller[GalleryImagesClientDeleteResponse], error)` +- New function `*GalleryImagesClient.Get(context.Context, string, string, *GalleryImagesClientGetOptions) (GalleryImagesClientGetResponse, error)` +- New function `*GalleryImagesClient.NewListAllPager(*GalleryImagesClientListAllOptions) *runtime.Pager[GalleryImagesClientListAllResponse]` +- New function `*GalleryImagesClient.NewListPager(string, *GalleryImagesClientListOptions) *runtime.Pager[GalleryImagesClientListResponse]` +- New function `*GalleryImagesClient.BeginUpdate(context.Context, string, string, GalleryImagesUpdateRequest, *GalleryImagesClientBeginUpdateOptions) (*runtime.Poller[GalleryImagesClientUpdateResponse], error)` +- New function `NewGuestAgentClient(azcore.TokenCredential, *arm.ClientOptions) (*GuestAgentClient, error)` +- New function `*GuestAgentClient.BeginCreate(context.Context, string, *GuestAgentClientBeginCreateOptions) (*runtime.Poller[GuestAgentClientCreateResponse], error)` +- New function `*GuestAgentClient.BeginDelete(context.Context, string, *GuestAgentClientBeginDeleteOptions) (*runtime.Poller[GuestAgentClientDeleteResponse], error)` +- New function `*GuestAgentClient.Get(context.Context, string, *GuestAgentClientGetOptions) (GuestAgentClientGetResponse, error)` +- New function `NewGuestAgentsClient(azcore.TokenCredential, *arm.ClientOptions) (*GuestAgentsClient, error)` +- New function `*GuestAgentsClient.NewListPager(string, *GuestAgentsClientListOptions) *runtime.Pager[GuestAgentsClientListResponse]` +- New function `NewHybridIdentityMetadataClient(azcore.TokenCredential, *arm.ClientOptions) (*HybridIdentityMetadataClient, error)` +- New function `*HybridIdentityMetadataClient.Get(context.Context, string, *HybridIdentityMetadataClientGetOptions) (HybridIdentityMetadataClientGetResponse, error)` +- New function `*HybridIdentityMetadataClient.NewListPager(string, *HybridIdentityMetadataClientListOptions) *runtime.Pager[HybridIdentityMetadataClientListResponse]` +- New function `NewLogicalNetworksClient(string, azcore.TokenCredential, *arm.ClientOptions) (*LogicalNetworksClient, error)` +- New function `*LogicalNetworksClient.BeginCreateOrUpdate(context.Context, string, string, LogicalNetworks, *LogicalNetworksClientBeginCreateOrUpdateOptions) (*runtime.Poller[LogicalNetworksClientCreateOrUpdateResponse], error)` +- New function `*LogicalNetworksClient.BeginDelete(context.Context, string, string, *LogicalNetworksClientBeginDeleteOptions) (*runtime.Poller[LogicalNetworksClientDeleteResponse], error)` +- New function `*LogicalNetworksClient.Get(context.Context, string, string, *LogicalNetworksClientGetOptions) (LogicalNetworksClientGetResponse, error)` +- New function `*LogicalNetworksClient.NewListAllPager(*LogicalNetworksClientListAllOptions) *runtime.Pager[LogicalNetworksClientListAllResponse]` +- New function `*LogicalNetworksClient.NewListPager(string, *LogicalNetworksClientListOptions) *runtime.Pager[LogicalNetworksClientListResponse]` +- New function `*LogicalNetworksClient.BeginUpdate(context.Context, string, string, LogicalNetworksUpdateRequest, *LogicalNetworksClientBeginUpdateOptions) (*runtime.Poller[LogicalNetworksClientUpdateResponse], error)` +- New function `NewMarketplaceGalleryImagesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MarketplaceGalleryImagesClient, error)` +- New function `*MarketplaceGalleryImagesClient.BeginCreateOrUpdate(context.Context, string, string, MarketplaceGalleryImages, *MarketplaceGalleryImagesClientBeginCreateOrUpdateOptions) (*runtime.Poller[MarketplaceGalleryImagesClientCreateOrUpdateResponse], error)` +- New function `*MarketplaceGalleryImagesClient.BeginDelete(context.Context, string, string, *MarketplaceGalleryImagesClientBeginDeleteOptions) (*runtime.Poller[MarketplaceGalleryImagesClientDeleteResponse], error)` +- New function `*MarketplaceGalleryImagesClient.Get(context.Context, string, string, *MarketplaceGalleryImagesClientGetOptions) (MarketplaceGalleryImagesClientGetResponse, error)` +- New function `*MarketplaceGalleryImagesClient.NewListAllPager(*MarketplaceGalleryImagesClientListAllOptions) *runtime.Pager[MarketplaceGalleryImagesClientListAllResponse]` +- New function `*MarketplaceGalleryImagesClient.NewListPager(string, *MarketplaceGalleryImagesClientListOptions) *runtime.Pager[MarketplaceGalleryImagesClientListResponse]` +- New function `*MarketplaceGalleryImagesClient.BeginUpdate(context.Context, string, string, MarketplaceGalleryImagesUpdateRequest, *MarketplaceGalleryImagesClientBeginUpdateOptions) (*runtime.Poller[MarketplaceGalleryImagesClientUpdateResponse], error)` +- New function `NewStorageContainersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*StorageContainersClient, error)` +- New function `*StorageContainersClient.BeginCreateOrUpdate(context.Context, string, string, StorageContainers, *StorageContainersClientBeginCreateOrUpdateOptions) (*runtime.Poller[StorageContainersClientCreateOrUpdateResponse], error)` +- New function `*StorageContainersClient.BeginDelete(context.Context, string, string, *StorageContainersClientBeginDeleteOptions) (*runtime.Poller[StorageContainersClientDeleteResponse], error)` +- New function `*StorageContainersClient.Get(context.Context, string, string, *StorageContainersClientGetOptions) (StorageContainersClientGetResponse, error)` +- New function `*StorageContainersClient.NewListAllPager(*StorageContainersClientListAllOptions) *runtime.Pager[StorageContainersClientListAllResponse]` +- New function `*StorageContainersClient.NewListPager(string, *StorageContainersClientListOptions) *runtime.Pager[StorageContainersClientListResponse]` +- New function `*StorageContainersClient.BeginUpdate(context.Context, string, string, StorageContainersUpdateRequest, *StorageContainersClientBeginUpdateOptions) (*runtime.Poller[StorageContainersClientUpdateResponse], error)` +- New function `NewVirtualHardDisksClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VirtualHardDisksClient, error)` +- New function `*VirtualHardDisksClient.BeginCreateOrUpdate(context.Context, string, string, VirtualHardDisks, *VirtualHardDisksClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualHardDisksClientCreateOrUpdateResponse], error)` +- New function `*VirtualHardDisksClient.BeginDelete(context.Context, string, string, *VirtualHardDisksClientBeginDeleteOptions) (*runtime.Poller[VirtualHardDisksClientDeleteResponse], error)` +- New function `*VirtualHardDisksClient.Get(context.Context, string, string, *VirtualHardDisksClientGetOptions) (VirtualHardDisksClientGetResponse, error)` +- New function `*VirtualHardDisksClient.NewListAllPager(*VirtualHardDisksClientListAllOptions) *runtime.Pager[VirtualHardDisksClientListAllResponse]` +- New function `*VirtualHardDisksClient.NewListPager(string, *VirtualHardDisksClientListOptions) *runtime.Pager[VirtualHardDisksClientListResponse]` +- New function `*VirtualHardDisksClient.BeginUpdate(context.Context, string, string, VirtualHardDisksUpdateRequest, *VirtualHardDisksClientBeginUpdateOptions) (*runtime.Poller[VirtualHardDisksClientUpdateResponse], error)` +- 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, VirtualMachineInstanceUpdateRequest, *VirtualMachineInstancesClientBeginUpdateOptions) (*runtime.Poller[VirtualMachineInstancesClientUpdateResponse], error)` +- New function `NewNetworkInterfacesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*NetworkInterfacesClient, error)` +- New function `*NetworkInterfacesClient.BeginCreateOrUpdate(context.Context, string, string, NetworkInterfaces, *NetworkInterfacesClientBeginCreateOrUpdateOptions) (*runtime.Poller[NetworkInterfacesClientCreateOrUpdateResponse], error)` +- New function `*NetworkInterfacesClient.BeginDelete(context.Context, string, string, *NetworkInterfacesClientBeginDeleteOptions) (*runtime.Poller[NetworkInterfacesClientDeleteResponse], error)` +- New function `*NetworkInterfacesClient.Get(context.Context, string, string, *NetworkInterfacesClientGetOptions) (NetworkInterfacesClientGetResponse, error)` +- New function `*NetworkInterfacesClient.NewListAllPager(*NetworkInterfacesClientListAllOptions) *runtime.Pager[NetworkInterfacesClientListAllResponse]` +- New function `*NetworkInterfacesClient.NewListPager(string, *NetworkInterfacesClientListOptions) *runtime.Pager[NetworkInterfacesClientListResponse]` +- New function `*NetworkInterfacesClient.BeginUpdate(context.Context, string, string, NetworkInterfacesUpdateRequest, *NetworkInterfacesClientBeginUpdateOptions) (*runtime.Poller[NetworkInterfacesClientUpdateResponse], error)` +- New struct `ExtendedLocation` +- New struct `GalleryImageIdentifier` +- New struct `GalleryImageProperties` +- New struct `GalleryImageStatus` +- New struct `GalleryImageStatusDownloadStatus` +- New struct `GalleryImageStatusProvisioningStatus` +- New struct `GalleryImageVersion` +- New struct `GalleryImageVersionProperties` +- New struct `GalleryImageVersionStorageProfile` +- New struct `GalleryImages` +- New struct `GalleryImagesListResult` +- New struct `GalleryImagesUpdateRequest` +- New struct `GalleryOSDiskImage` +- New struct `GuestAgent` +- New struct `GuestAgentInstallStatus` +- New struct `GuestAgentList` +- New struct `GuestAgentProperties` +- New struct `GuestCredential` +- New struct `HTTPProxyConfiguration` +- New struct `HardwareProfileUpdate` +- New struct `HybridIdentityMetadata` +- New struct `HybridIdentityMetadataList` +- New struct `HybridIdentityMetadataProperties` +- New struct `IPConfiguration` +- New struct `IPConfigurationProperties` +- New struct `IPConfigurationPropertiesSubnet` +- New struct `IPPool` +- New struct `IPPoolInfo` +- New struct `Identity` +- New struct `InstanceViewStatus` +- New struct `InterfaceDNSSettings` +- New struct `LogicalNetworkProperties` +- New struct `LogicalNetworkPropertiesDhcpOptions` +- New struct `LogicalNetworkStatus` +- New struct `LogicalNetworkStatusProvisioningStatus` +- New struct `LogicalNetworks` +- New struct `LogicalNetworksListResult` +- New struct `LogicalNetworksUpdateRequest` +- New struct `MarketplaceGalleryImageProperties` +- New struct `MarketplaceGalleryImageStatus` +- New struct `MarketplaceGalleryImageStatusDownloadStatus` +- New struct `MarketplaceGalleryImageStatusProvisioningStatus` +- New struct `MarketplaceGalleryImages` +- New struct `MarketplaceGalleryImagesListResult` +- New struct `MarketplaceGalleryImagesUpdateRequest` +- New struct `NetworkInterfaceProperties` +- New struct `NetworkInterfaceStatus` +- New struct `NetworkInterfaceStatusProvisioningStatus` +- New struct `NetworkInterfaces` +- New struct `NetworkInterfacesListResult` +- New struct `NetworkInterfacesUpdateRequest` +- New struct `NetworkProfileUpdate` +- New struct `NetworkProfileUpdateNetworkInterfacesItem` +- New struct `OsProfileUpdate` +- New struct `OsProfileUpdateLinuxConfiguration` +- New struct `OsProfileUpdateWindowsConfiguration` +- New struct `Route` +- New struct `RoutePropertiesFormat` +- New struct `RouteTable` +- New struct `RouteTablePropertiesFormat` +- New struct `SSHConfiguration` +- New struct `SSHPublicKey` +- New struct `StorageContainerProperties` +- New struct `StorageContainerStatus` +- New struct `StorageContainerStatusProvisioningStatus` +- New struct `StorageContainers` +- New struct `StorageContainersListResult` +- New struct `StorageContainersUpdateRequest` +- New struct `StorageProfileUpdate` +- New struct `StorageProfileUpdateDataDisksItem` +- New struct `Subnet` +- New struct `SubnetPropertiesFormat` +- New struct `SubnetPropertiesFormatIPConfigurationReferencesItem` +- New struct `VirtualHardDiskProperties` +- New struct `VirtualHardDiskStatus` +- New struct `VirtualHardDiskStatusProvisioningStatus` +- New struct `VirtualHardDisks` +- New struct `VirtualHardDisksListResult` +- New struct `VirtualHardDisksUpdateRequest` +- New struct `VirtualMachineConfigAgentInstanceView` +- New struct `VirtualMachineInstance` +- New struct `VirtualMachineInstanceListResult` +- New struct `VirtualMachineInstanceProperties` +- New struct `VirtualMachineInstancePropertiesHardwareProfile` +- New struct `VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig` +- New struct `VirtualMachineInstancePropertiesNetworkProfile` +- New struct `VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem` +- New struct `VirtualMachineInstancePropertiesOsProfile` +- New struct `VirtualMachineInstancePropertiesOsProfileLinuxConfiguration` +- New struct `VirtualMachineInstancePropertiesOsProfileWindowsConfiguration` +- New struct `VirtualMachineInstancePropertiesSecurityProfile` +- New struct `VirtualMachineInstancePropertiesSecurityProfileUefiSettings` +- New struct `VirtualMachineInstancePropertiesStorageProfile` +- New struct `VirtualMachineInstancePropertiesStorageProfileDataDisksItem` +- New struct `VirtualMachineInstancePropertiesStorageProfileImageReference` +- New struct `VirtualMachineInstancePropertiesStorageProfileOsDisk` +- New struct `VirtualMachineInstanceStatus` +- New struct `VirtualMachineInstanceStatusProvisioningStatus` +- New struct `VirtualMachineInstanceUpdateProperties` +- New struct `VirtualMachineInstanceUpdateRequest` +- New struct `VirtualMachineInstanceView` + + ## 1.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client.go deleted file mode 100644 index c45d79b0cbac..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client.go +++ /dev/null @@ -1,509 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armazurestackhci - -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" -) - -// ArcSettingsClient contains the methods for the ArcSettings group. -// Don't use this type directly, use NewArcSettingsClient() instead. -type ArcSettingsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewArcSettingsClient creates a new instance of ArcSettingsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewArcSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ArcSettingsClient, error) { - cl, err := arm.NewClient(moduleName+".ArcSettingsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ArcSettingsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create ArcSetting for HCI cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. -// - arcSetting - Parameters supplied to the Create ArcSetting resource for this HCI cluster. -// - options - ArcSettingsClientCreateOptions contains the optional parameters for the ArcSettingsClient.Create method. -func (client *ArcSettingsClient) Create(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting ArcSetting, options *ArcSettingsClientCreateOptions) (ArcSettingsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, arcSetting, options) - if err != nil { - return ArcSettingsClientCreateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ArcSettingsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ArcSettingsClientCreateResponse{}, runtime.NewResponseError(resp) - } - return client.createHandleResponse(resp) -} - -// createCreateRequest creates the Create request. -func (client *ArcSettingsClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting ArcSetting, options *ArcSettingsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if arcSettingName == "" { - return nil, errors.New("parameter arcSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, arcSetting) -} - -// createHandleResponse handles the Create response. -func (client *ArcSettingsClient) createHandleResponse(resp *http.Response) (ArcSettingsClientCreateResponse, error) { - result := ArcSettingsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ArcSetting); err != nil { - return ArcSettingsClientCreateResponse{}, err - } - return result, nil -} - -// BeginCreateIdentity - Create Aad identity for arc settings. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. -// - options - ArcSettingsClientBeginCreateIdentityOptions contains the optional parameters for the ArcSettingsClient.BeginCreateIdentity -// method. -func (client *ArcSettingsClient) BeginCreateIdentity(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginCreateIdentityOptions) (*runtime.Poller[ArcSettingsClientCreateIdentityResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createIdentity(ctx, resourceGroupName, clusterName, arcSettingName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ArcSettingsClientCreateIdentityResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[ArcSettingsClientCreateIdentityResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateIdentity - Create Aad identity for arc settings. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -func (client *ArcSettingsClient) createIdentity(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginCreateIdentityOptions) (*http.Response, error) { - req, err := client.createIdentityCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, 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 -} - -// createIdentityCreateRequest creates the CreateIdentity request. -func (client *ArcSettingsClient) createIdentityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginCreateIdentityOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if arcSettingName == "" { - return nil, errors.New("parameter arcSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// BeginDelete - Delete ArcSetting resource details of HCI Cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. -// - options - ArcSettingsClientBeginDeleteOptions contains the optional parameters for the ArcSettingsClient.BeginDelete method. -func (client *ArcSettingsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginDeleteOptions) (*runtime.Poller[ArcSettingsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, arcSettingName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ArcSettingsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[ArcSettingsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Delete ArcSetting resource details of HCI Cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -func (client *ArcSettingsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, 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 *ArcSettingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if arcSettingName == "" { - return nil, errors.New("parameter arcSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// GeneratePassword - Generate password for arc settings. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. -// - options - ArcSettingsClientGeneratePasswordOptions contains the optional parameters for the ArcSettingsClient.GeneratePassword -// method. -func (client *ArcSettingsClient) GeneratePassword(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientGeneratePasswordOptions) (ArcSettingsClientGeneratePasswordResponse, error) { - req, err := client.generatePasswordCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, options) - if err != nil { - return ArcSettingsClientGeneratePasswordResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ArcSettingsClientGeneratePasswordResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ArcSettingsClientGeneratePasswordResponse{}, runtime.NewResponseError(resp) - } - return client.generatePasswordHandleResponse(resp) -} - -// generatePasswordCreateRequest creates the GeneratePassword request. -func (client *ArcSettingsClient) generatePasswordCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientGeneratePasswordOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/generatePassword" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if arcSettingName == "" { - return nil, errors.New("parameter arcSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// generatePasswordHandleResponse handles the GeneratePassword response. -func (client *ArcSettingsClient) generatePasswordHandleResponse(resp *http.Response) (ArcSettingsClientGeneratePasswordResponse, error) { - result := ArcSettingsClientGeneratePasswordResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PasswordCredential); err != nil { - return ArcSettingsClientGeneratePasswordResponse{}, err - } - return result, nil -} - -// Get - Get ArcSetting resource details of HCI Cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. -// - options - ArcSettingsClientGetOptions contains the optional parameters for the ArcSettingsClient.Get method. -func (client *ArcSettingsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientGetOptions) (ArcSettingsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, options) - if err != nil { - return ArcSettingsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ArcSettingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ArcSettingsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ArcSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if arcSettingName == "" { - return nil, errors.New("parameter arcSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ArcSettingsClient) getHandleResponse(resp *http.Response) (ArcSettingsClientGetResponse, error) { - result := ArcSettingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ArcSetting); err != nil { - return ArcSettingsClientGetResponse{}, err - } - return result, nil -} - -// NewListByClusterPager - Get ArcSetting resources of HCI Cluster. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - options - ArcSettingsClientListByClusterOptions contains the optional parameters for the ArcSettingsClient.NewListByClusterPager -// method. -func (client *ArcSettingsClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *ArcSettingsClientListByClusterOptions) *runtime.Pager[ArcSettingsClientListByClusterResponse] { - return runtime.NewPager(runtime.PagingHandler[ArcSettingsClientListByClusterResponse]{ - More: func(page ArcSettingsClientListByClusterResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ArcSettingsClientListByClusterResponse) (ArcSettingsClientListByClusterResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ArcSettingsClientListByClusterResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ArcSettingsClientListByClusterResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ArcSettingsClientListByClusterResponse{}, runtime.NewResponseError(resp) - } - return client.listByClusterHandleResponse(resp) - }, - }) -} - -// listByClusterCreateRequest creates the ListByCluster request. -func (client *ArcSettingsClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ArcSettingsClientListByClusterOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByClusterHandleResponse handles the ListByCluster response. -func (client *ArcSettingsClient) listByClusterHandleResponse(resp *http.Response) (ArcSettingsClientListByClusterResponse, error) { - result := ArcSettingsClientListByClusterResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ArcSettingList); err != nil { - return ArcSettingsClientListByClusterResponse{}, err - } - return result, nil -} - -// Update - Update ArcSettings for HCI cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. -// - arcSetting - ArcSettings parameters that needs to be updated -// - options - ArcSettingsClientUpdateOptions contains the optional parameters for the ArcSettingsClient.Update method. -func (client *ArcSettingsClient) Update(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting ArcSettingsPatch, options *ArcSettingsClientUpdateOptions) (ArcSettingsClientUpdateResponse, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, arcSetting, options) - if err != nil { - return ArcSettingsClientUpdateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ArcSettingsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ArcSettingsClientUpdateResponse{}, runtime.NewResponseError(resp) - } - return client.updateHandleResponse(resp) -} - -// updateCreateRequest creates the Update request. -func (client *ArcSettingsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting ArcSettingsPatch, options *ArcSettingsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if arcSettingName == "" { - return nil, errors.New("parameter arcSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, arcSetting) -} - -// updateHandleResponse handles the Update response. -func (client *ArcSettingsClient) updateHandleResponse(resp *http.Response) (ArcSettingsClientUpdateResponse, error) { - result := ArcSettingsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ArcSetting); err != nil { - return ArcSettingsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client_example_test.go deleted file mode 100644 index 6d87f6635511..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client_example_test.go +++ /dev/null @@ -1,309 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armazurestackhci_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/ListArcSettingsByCluster.json -func ExampleArcSettingsClient_NewListByClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewArcSettingsClient().NewListByClusterPager("test-rg", "myCluster", 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.ArcSettingList = armazurestackhci.ArcSettingList{ - // Value: []*armazurestackhci.ArcSetting{ - // { - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters/arcSettings"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster/arcSettings/default"), - // Properties: &armazurestackhci.ArcSettingProperties{ - // AggregateState: to.Ptr(armazurestackhci.ArcSettingAggregateStatePartiallyConnected), - // ArcInstanceResourceGroup: to.Ptr("ArcInstance-rg"), - // PerNodeDetails: []*armazurestackhci.PerNodeState{ - // { - // Name: to.Ptr("Node-1"), - // ArcInstance: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-1"), - // State: to.Ptr(armazurestackhci.NodeArcStateConnected), - // }, - // { - // Name: to.Ptr("Node-2"), - // ArcInstance: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-2"), - // State: to.Ptr(armazurestackhci.NodeArcStateDisconnected), - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/GetArcSetting.json -func ExampleArcSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewArcSettingsClient().Get(ctx, "test-rg", "myCluster", "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.ArcSetting = armazurestackhci.ArcSetting{ - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters/arcSettings"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster/arcSettings/default"), - // Properties: &armazurestackhci.ArcSettingProperties{ - // AggregateState: to.Ptr(armazurestackhci.ArcSettingAggregateStatePartiallyConnected), - // ArcInstanceResourceGroup: to.Ptr("ArcInstance-rg"), - // PerNodeDetails: []*armazurestackhci.PerNodeState{ - // { - // Name: to.Ptr("Node-1"), - // ArcInstance: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-1"), - // State: to.Ptr(armazurestackhci.NodeArcStateConnected), - // }, - // { - // Name: to.Ptr("Node-2"), - // ArcInstance: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-2"), - // State: to.Ptr(armazurestackhci.NodeArcStateDisconnected), - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/PutArcSetting.json -func ExampleArcSettingsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewArcSettingsClient().Create(ctx, "test-rg", "myCluster", "default", armazurestackhci.ArcSetting{}, 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.ArcSetting = armazurestackhci.ArcSetting{ - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters/arcSettings"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster/arcSettings/default"), - // Properties: &armazurestackhci.ArcSettingProperties{ - // AggregateState: to.Ptr(armazurestackhci.ArcSettingAggregateStateCreating), - // ArcInstanceResourceGroup: to.Ptr("ArcInstance-rg"), - // ConnectivityProperties: map[string]any{ - // "enabled": false, - // }, - // PerNodeDetails: []*armazurestackhci.PerNodeState{ - // { - // Name: to.Ptr("Node-1"), - // ArcInstance: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-1"), - // State: to.Ptr(armazurestackhci.NodeArcStateCreating), - // }, - // { - // Name: to.Ptr("Node-2"), - // ArcInstance: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-2"), - // State: to.Ptr(armazurestackhci.NodeArcStateCreating), - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/PatchArcSetting.json -func ExampleArcSettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewArcSettingsClient().Update(ctx, "test-rg", "myCluster", "default", armazurestackhci.ArcSettingsPatch{ - Properties: &armazurestackhci.ArcSettingsPatchProperties{ - ConnectivityProperties: map[string]any{ - "enabled": true, - }, - }, - }, 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.ArcSetting = armazurestackhci.ArcSetting{ - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters/arcSettings"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster/arcSettings/default"), - // Properties: &armazurestackhci.ArcSettingProperties{ - // AggregateState: to.Ptr(armazurestackhci.ArcSettingAggregateStateCreating), - // ArcInstanceResourceGroup: to.Ptr("ArcInstance-rg"), - // ConnectivityProperties: map[string]any{ - // "enabled": true, - // }, - // PerNodeDetails: []*armazurestackhci.PerNodeState{ - // { - // Name: to.Ptr("Node-1"), - // ArcInstance: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-1"), - // State: to.Ptr(armazurestackhci.NodeArcStateCreating), - // }, - // { - // Name: to.Ptr("Node-2"), - // ArcInstance: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-2"), - // State: to.Ptr(armazurestackhci.NodeArcStateCreating), - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/DeleteArcSetting.json -func ExampleArcSettingsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewArcSettingsClient().BeginDelete(ctx, "test-rg", "myCluster", "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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/GeneratePassword.json -func ExampleArcSettingsClient_GeneratePassword() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewArcSettingsClient().GeneratePassword(ctx, "test-rg", "myCluster", "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.PasswordCredential = armazurestackhci.PasswordCredential{ - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2121-02-17T16:24:23.6264377+05:30"); return t}()), - // KeyID: to.Ptr("00000000-2d47-4fb2-8ed2-fed71a5c197b"), - // SecretText: to.Ptr("secretText"), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-17T16:24:23.6264005+05:30"); return t}()), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/CreateArcIdentity.json -func ExampleArcSettingsClient_BeginCreateIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewArcSettingsClient().BeginCreateIdentity(ctx, "test-rg", "myCluster", "default", 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.ArcIdentityResponse = armazurestackhci.ArcIdentityResponse{ - // Properties: &armazurestackhci.ArcIdentityResponseProperties{ - // ArcApplicationClientID: to.Ptr("7b93bf67-60ac-4909-a987-ac438e69f9ba"), - // ArcApplicationObjectID: to.Ptr("400bd05f-395f-45a6-ba75-72601df80107"), - // ArcApplicationTenantID: to.Ptr("bdb2c88c-9cfd-4e19-927d-51e875f6912b"), - // ArcServicePrincipalObjectID: to.Ptr("00cc4014-482e-4de9-9932-83415cc75f45"), - // }, - // } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md b/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md index e36159615fc2..3c5da4555118 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.1 - +module-version: 2.0.0-beta.1 +tag: package-preview-2023-09 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/build.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/build.go index fb8bdeac2464..661d0644ef49 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/build.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/build.go @@ -2,6 +2,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/azurestackhci/armazurestackhci +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -removeUnreferencedTypes resourcemanager/azurestackhci/armazurestackhci package armazurestackhci diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/client_factory.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/client_factory.go index 67a132004c3f..02b9a44d166e 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/client_factory.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armazurestackhci @@ -38,18 +37,38 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewArcSettingsClient() *ArcSettingsClient { - subClient, _ := NewArcSettingsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewGalleryImagesClient() *GalleryImagesClient { + subClient, _ := NewGalleryImagesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewClustersClient() *ClustersClient { - subClient, _ := NewClustersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewGuestAgentClient() *GuestAgentClient { + subClient, _ := NewGuestAgentClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewExtensionsClient() *ExtensionsClient { - subClient, _ := NewExtensionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewGuestAgentsClient() *GuestAgentsClient { + subClient, _ := NewGuestAgentsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient { + subClient, _ := NewHybridIdentityMetadataClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLogicalNetworksClient() *LogicalNetworksClient { + subClient, _ := NewLogicalNetworksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewMarketplaceGalleryImagesClient() *MarketplaceGalleryImagesClient { + subClient, _ := NewMarketplaceGalleryImagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewNetworkInterfacesClient() *NetworkInterfacesClient { + subClient, _ := NewNetworkInterfacesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -57,3 +76,18 @@ func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } + +func (c *ClientFactory) NewStorageContainersClient() *StorageContainersClient { + subClient, _ := NewStorageContainersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualHardDisksClient() *VirtualHardDisksClient { + subClient, _ := NewVirtualHardDisksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualMachineInstancesClient() *VirtualMachineInstancesClient { + subClient, _ := NewVirtualMachineInstancesClient(c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client.go deleted file mode 100644 index 218f4eb9a9a0..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client.go +++ /dev/null @@ -1,542 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armazurestackhci - -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" -) - -// ClustersClient contains the methods for the Clusters group. -// Don't use this type directly, use NewClustersClient() instead. -type ClustersClient struct { - internal *arm.Client - subscriptionID string -} - -// NewClustersClient creates a new instance of ClustersClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClustersClient, error) { - cl, err := arm.NewClient(moduleName+".ClustersClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ClustersClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create an HCI cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - cluster - Details of the HCI cluster. -// - options - ClustersClientCreateOptions contains the optional parameters for the ClustersClient.Create method. -func (client *ClustersClient) Create(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster, options *ClustersClientCreateOptions) (ClustersClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, cluster, options) - if err != nil { - return ClustersClientCreateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ClustersClientCreateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientCreateResponse{}, runtime.NewResponseError(resp) - } - return client.createHandleResponse(resp) -} - -// createCreateRequest creates the Create request. -func (client *ClustersClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster, options *ClustersClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, cluster) -} - -// createHandleResponse handles the Create response. -func (client *ClustersClient) createHandleResponse(resp *http.Response) (ClustersClientCreateResponse, error) { - result := ClustersClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil { - return ClustersClientCreateResponse{}, err - } - return result, nil -} - -// BeginCreateIdentity - Create cluster identity. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - options - ClustersClientBeginCreateIdentityOptions contains the optional parameters for the ClustersClient.BeginCreateIdentity -// method. -func (client *ClustersClient) BeginCreateIdentity(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginCreateIdentityOptions) (*runtime.Poller[ClustersClientCreateIdentityResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createIdentity(ctx, resourceGroupName, clusterName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientCreateIdentityResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[ClustersClientCreateIdentityResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateIdentity - Create cluster identity. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -func (client *ClustersClient) createIdentity(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginCreateIdentityOptions) (*http.Response, error) { - req, err := client.createIdentityCreateRequest(ctx, resourceGroupName, clusterName, 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 -} - -// createIdentityCreateRequest creates the CreateIdentity request. -func (client *ClustersClient) createIdentityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginCreateIdentityOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/createClusterIdentity" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// BeginDelete - Delete an HCI cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - options - ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. -func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*runtime.Poller[ClustersClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ClustersClientDeleteResponse](resp, client.internal.Pipeline(), nil) - } else { - return runtime.NewPollerFromResumeToken[ClustersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Delete an HCI cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options) - if err != nil { - 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 *ClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get HCI cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The 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) { - req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, options) - if err != nil { - return ClustersClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ClustersClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersClientGetResponse, error) { - result := ClustersClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil { - return ClustersClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - List all HCI clusters in a resource group. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager -// method. -func (client *ClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *ClustersClientListByResourceGroupOptions) *runtime.Pager[ClustersClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[ClustersClientListByResourceGroupResponse]{ - More: func(page ClustersClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ClustersClientListByResourceGroupResponse) (ClustersClientListByResourceGroupResponse, 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 ClustersClientListByResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ClustersClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(resp) - }, - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClustersClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters" - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (ClustersClientListByResourceGroupResponse, error) { - result := ClustersClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ClusterList); err != nil { - return ClustersClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - List all HCI clusters in a subscription. -// -// Generated from API version 2022-05-01 -// - options - ClustersClientListBySubscriptionOptions contains the optional parameters for the ClustersClient.NewListBySubscriptionPager -// method. -func (client *ClustersClient) NewListBySubscriptionPager(options *ClustersClientListBySubscriptionOptions) *runtime.Pager[ClustersClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[ClustersClientListBySubscriptionResponse]{ - More: func(page ClustersClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ClustersClientListBySubscriptionResponse) (ClustersClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ClustersClientListBySubscriptionResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ClustersClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } - return client.listBySubscriptionHandleResponse(resp) - }, - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *ClustersClient) listBySubscriptionCreateRequest(ctx context.Context, options *ClustersClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters" - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *ClustersClient) listBySubscriptionHandleResponse(resp *http.Response) (ClustersClientListBySubscriptionResponse, error) { - result := ClustersClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ClusterList); err != nil { - return ClustersClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Update an HCI cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - cluster - Details of the HCI cluster. -// - options - ClustersClientUpdateOptions contains the optional parameters for the ClustersClient.Update method. -func (client *ClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, cluster ClusterPatch, options *ClustersClientUpdateOptions) (ClustersClientUpdateResponse, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, cluster, options) - if err != nil { - return ClustersClientUpdateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ClustersClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientUpdateResponse{}, runtime.NewResponseError(resp) - } - return client.updateHandleResponse(resp) -} - -// updateCreateRequest creates the Update request. -func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, cluster ClusterPatch, options *ClustersClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, cluster) -} - -// updateHandleResponse handles the Update response. -func (client *ClustersClient) updateHandleResponse(resp *http.Response) (ClustersClientUpdateResponse, error) { - result := ClustersClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil { - return ClustersClientUpdateResponse{}, err - } - return result, nil -} - -// BeginUploadCertificate - Upload certificate. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - uploadCertificateRequest - Upload certificate request. -// - options - ClustersClientBeginUploadCertificateOptions contains the optional parameters for the ClustersClient.BeginUploadCertificate -// method. -func (client *ClustersClient) BeginUploadCertificate(ctx context.Context, resourceGroupName string, clusterName string, uploadCertificateRequest UploadCertificateRequest, options *ClustersClientBeginUploadCertificateOptions) (*runtime.Poller[ClustersClientUploadCertificateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.uploadCertificate(ctx, resourceGroupName, clusterName, uploadCertificateRequest, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientUploadCertificateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[ClustersClientUploadCertificateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// UploadCertificate - Upload certificate. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -func (client *ClustersClient) uploadCertificate(ctx context.Context, resourceGroupName string, clusterName string, uploadCertificateRequest UploadCertificateRequest, options *ClustersClientBeginUploadCertificateOptions) (*http.Response, error) { - req, err := client.uploadCertificateCreateRequest(ctx, resourceGroupName, clusterName, uploadCertificateRequest, 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.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// uploadCertificateCreateRequest creates the UploadCertificate request. -func (client *ClustersClient) uploadCertificateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, uploadCertificateRequest UploadCertificateRequest, options *ClustersClientBeginUploadCertificateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/uploadCertificate" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, uploadCertificateRequest) -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client_example_test.go deleted file mode 100644 index 11909f673108..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client_example_test.go +++ /dev/null @@ -1,645 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armazurestackhci_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/azurestackhci/armazurestackhci" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/ListClustersBySubscription.json -func ExampleClustersClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListBySubscriptionPager(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.ClusterList = armazurestackhci.ClusterList{ - // Value: []*armazurestackhci.Cluster{ - // { - // Name: to.Ptr("myCluster1"), - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg1/providers/Microsoft.AzureStackHCI/clusters/myCluster1"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Properties: &armazurestackhci.ClusterProperties{ - // AADClientID: to.Ptr("515da1c2-379e-49b4-9975-09e3e40c86be"), - // AADTenantID: to.Ptr("7e589cc1-a8b6-4dff-91bd-5ec0fa18db94"), - // BillingModel: to.Ptr("Trial"), - // CloudID: to.Ptr("91c2b355-4826-4e96-9164-e3f26dcf1cdd"), - // CloudManagementEndpoint: to.Ptr("https://98294836-31be-4668-aeae-698667faf99b.waconazure.com"), - // DesiredProperties: &armazurestackhci.ClusterDesiredProperties{ - // DiagnosticLevel: to.Ptr(armazurestackhci.DiagnosticLevelBasic), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // ReportedProperties: &armazurestackhci.ClusterReportedProperties{ - // }, - // Status: to.Ptr(armazurestackhci.StatusNotYetRegistered), - // TrialDaysRemaining: to.Ptr[float32](29), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("myCluster2"), - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg2/providers/Microsoft.AzureStackHCI/clusters/myCluster2"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armazurestackhci.ClusterProperties{ - // AADClientID: to.Ptr("24a6e53d-04e5-44d2-b7cc-1b732a847dfc"), - // AADTenantID: to.Ptr("7e589cc1-a8b6-4dff-91bd-5ec0fa18db94"), - // BillingModel: to.Ptr("Trial"), - // CloudID: to.Ptr("a3c0468f-e38e-4dda-ac48-817f620536f0"), - // CloudManagementEndpoint: to.Ptr("https://98294836-31be-4668-aeae-698667faf99b.waconazure.com"), - // DesiredProperties: &armazurestackhci.ClusterDesiredProperties{ - // DiagnosticLevel: to.Ptr(armazurestackhci.DiagnosticLevelBasic), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // LastBillingTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T08:12:55.2312022Z"); return t}()), - // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T20:44:32.5625121Z"); return t}()), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // RegistrationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T20:44:32.5625121Z"); return t}()), - // ReportedProperties: &armazurestackhci.ClusterReportedProperties{ - // ClusterID: to.Ptr("a76ac23a-1819-4e82-9410-e3e4ec3d1425"), - // ClusterName: to.Ptr("cluster1"), - // ClusterVersion: to.Ptr("10.0.17777"), - // DiagnosticLevel: to.Ptr(armazurestackhci.DiagnosticLevelBasic), - // ImdsAttestation: to.Ptr(armazurestackhci.ImdsAttestationDisabled), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T19:24:42.1946017Z"); return t}()), - // Nodes: []*armazurestackhci.ClusterNode{ - // { - // Name: to.Ptr("Node1"), - // CoreCount: to.Ptr[float32](8), - // ID: to.Ptr[float32](0), - // Manufacturer: to.Ptr("Dell Inc."), - // MemoryInGiB: to.Ptr[float32](128), - // Model: to.Ptr("EMC AX740"), - // OSName: to.Ptr("Azure Stack HCI"), - // OSVersion: to.Ptr("10.0.17777.1061"), - // SerialNumber: to.Ptr("Q45CZC3"), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // { - // Name: to.Ptr("Node2"), - // CoreCount: to.Ptr[float32](8), - // ID: to.Ptr[float32](1), - // Manufacturer: to.Ptr("Dell Inc."), - // MemoryInGiB: to.Ptr[float32](128), - // Model: to.Ptr("EMC AX740"), - // OSName: to.Ptr("Azure Stack HCI"), - // OSVersion: to.Ptr("10.0.17777.1061"), - // SerialNumber: to.Ptr("Q44BSC3"), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // { - // Name: to.Ptr("Node3"), - // CoreCount: to.Ptr[float32](16), - // ID: to.Ptr[float32](2), - // Manufacturer: to.Ptr("Dell Inc."), - // MemoryInGiB: to.Ptr[float32](256), - // Model: to.Ptr("EMC AX740"), - // OSName: to.Ptr("Azure Stack HCI"), - // OSVersion: to.Ptr("10.0.17777.1061"), - // SerialNumber: to.Ptr("Q44RFC3"), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }}, - // }, - // Status: to.Ptr(armazurestackhci.StatusConnectedRecently), - // TrialDaysRemaining: to.Ptr[float32](30), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/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 := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListByResourceGroupPager("test-rg", 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.ClusterList = armazurestackhci.ClusterList{ - // Value: []*armazurestackhci.Cluster{ - // { - // Name: to.Ptr("myCluster1"), - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster1"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Properties: &armazurestackhci.ClusterProperties{ - // AADClientID: to.Ptr("515da1c2-379e-49b4-9975-09e3e40c86be"), - // AADTenantID: to.Ptr("7e589cc1-a8b6-4dff-91bd-5ec0fa18db94"), - // BillingModel: to.Ptr("Trial"), - // CloudID: to.Ptr("91c2b355-4826-4e96-9164-e3f26dcf1cdd"), - // CloudManagementEndpoint: to.Ptr("https://98294836-31be-4668-aeae-698667faf99b.waconazure.com"), - // DesiredProperties: &armazurestackhci.ClusterDesiredProperties{ - // DiagnosticLevel: to.Ptr(armazurestackhci.DiagnosticLevelBasic), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // ReportedProperties: &armazurestackhci.ClusterReportedProperties{ - // }, - // Status: to.Ptr(armazurestackhci.StatusNotYetRegistered), - // TrialDaysRemaining: to.Ptr[float32](29), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("myCluster2"), - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster2"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Properties: &armazurestackhci.ClusterProperties{ - // AADClientID: to.Ptr("24a6e53d-04e5-44d2-b7cc-1b732a847dfc"), - // AADTenantID: to.Ptr("7e589cc1-a8b6-4dff-91bd-5ec0fa18db94"), - // BillingModel: to.Ptr("Trial"), - // CloudID: to.Ptr("a3c0468f-e38e-4dda-ac48-817f620536f0"), - // CloudManagementEndpoint: to.Ptr("https://98294836-31be-4668-aeae-698667faf99b.waconazure.com"), - // DesiredProperties: &armazurestackhci.ClusterDesiredProperties{ - // DiagnosticLevel: to.Ptr(armazurestackhci.DiagnosticLevelBasic), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // LastBillingTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T08:12:55.2312022Z"); return t}()), - // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T20:44:32.5625121Z"); return t}()), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // RegistrationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T20:44:32.5625121Z"); return t}()), - // ReportedProperties: &armazurestackhci.ClusterReportedProperties{ - // ClusterID: to.Ptr("a76ac23a-1819-4e82-9410-e3e4ec3d1425"), - // ClusterName: to.Ptr("cluster1"), - // ClusterVersion: to.Ptr("10.0.17777"), - // DiagnosticLevel: to.Ptr(armazurestackhci.DiagnosticLevelBasic), - // ImdsAttestation: to.Ptr(armazurestackhci.ImdsAttestationDisabled), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T19:24:42.1946017Z"); return t}()), - // Nodes: []*armazurestackhci.ClusterNode{ - // { - // Name: to.Ptr("Node1"), - // CoreCount: to.Ptr[float32](8), - // ID: to.Ptr[float32](0), - // Manufacturer: to.Ptr("Dell Inc."), - // MemoryInGiB: to.Ptr[float32](128), - // Model: to.Ptr("EMC AX740"), - // OSName: to.Ptr("Azure Stack HCI"), - // OSVersion: to.Ptr("10.0.17777.1061"), - // SerialNumber: to.Ptr("Q45CZC3"), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // { - // Name: to.Ptr("Node2"), - // CoreCount: to.Ptr[float32](8), - // ID: to.Ptr[float32](1), - // Manufacturer: to.Ptr("Dell Inc."), - // MemoryInGiB: to.Ptr[float32](128), - // Model: to.Ptr("EMC AX740"), - // OSName: to.Ptr("Azure Stack HCI"), - // OSVersion: to.Ptr("10.0.17777.1061"), - // SerialNumber: to.Ptr("Q44BSC3"), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // { - // Name: to.Ptr("Node3"), - // CoreCount: to.Ptr[float32](16), - // ID: to.Ptr[float32](2), - // Manufacturer: to.Ptr("Dell Inc."), - // MemoryInGiB: to.Ptr[float32](256), - // Model: to.Ptr("EMC AX740"), - // OSName: to.Ptr("Azure Stack HCI"), - // OSVersion: to.Ptr("10.0.17777.1061"), - // SerialNumber: to.Ptr("Q44RFC3"), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }}, - // }, - // Status: to.Ptr(armazurestackhci.StatusConnectedRecently), - // TrialDaysRemaining: to.Ptr[float32](30), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/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 := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().Get(ctx, "test-rg", "myCluster", 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 = armazurestackhci.Cluster{ - // Name: to.Ptr("myCluster"), - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Properties: &armazurestackhci.ClusterProperties{ - // AADClientID: to.Ptr("24a6e53d-04e5-44d2-b7cc-1b732a847dfc"), - // AADTenantID: to.Ptr("7e589cc1-a8b6-4dff-91bd-5ec0fa18db94"), - // BillingModel: to.Ptr("Trial"), - // CloudID: to.Ptr("a3c0468f-e38e-4dda-ac48-817f620536f0"), - // CloudManagementEndpoint: to.Ptr("https://98294836-31be-4668-aeae-698667faf99b.waconazure.com"), - // DesiredProperties: &armazurestackhci.ClusterDesiredProperties{ - // DiagnosticLevel: to.Ptr(armazurestackhci.DiagnosticLevelBasic), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // LastBillingTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T08:12:55.2312022Z"); return t}()), - // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T20:44:32.5625121Z"); return t}()), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // RegistrationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T20:44:32.5625121Z"); return t}()), - // ReportedProperties: &armazurestackhci.ClusterReportedProperties{ - // ClusterID: to.Ptr("a76ac23a-1819-4e82-9410-e3e4ec3d1425"), - // ClusterName: to.Ptr("cluster1"), - // ClusterVersion: to.Ptr("10.0.17777"), - // DiagnosticLevel: to.Ptr(armazurestackhci.DiagnosticLevelBasic), - // ImdsAttestation: to.Ptr(armazurestackhci.ImdsAttestationDisabled), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T19:24:42.1946017Z"); return t}()), - // Nodes: []*armazurestackhci.ClusterNode{ - // { - // Name: to.Ptr("Node1"), - // CoreCount: to.Ptr[float32](8), - // ID: to.Ptr[float32](1), - // Manufacturer: to.Ptr("Dell Inc."), - // MemoryInGiB: to.Ptr[float32](128), - // Model: to.Ptr("EMC AX740"), - // OSName: to.Ptr("Azure Stack HCI"), - // OSVersion: to.Ptr("10.0.17777.1061"), - // SerialNumber: to.Ptr("Q45CZC3"), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // { - // Name: to.Ptr("Node2"), - // CoreCount: to.Ptr[float32](8), - // ID: to.Ptr[float32](2), - // Manufacturer: to.Ptr("Dell Inc."), - // MemoryInGiB: to.Ptr[float32](128), - // Model: to.Ptr("EMC AX740"), - // OSName: to.Ptr("Azure Stack HCI"), - // OSVersion: to.Ptr("10.0.17777.1061"), - // SerialNumber: to.Ptr("Q44BSC3"), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // { - // Name: to.Ptr("Node3"), - // CoreCount: to.Ptr[float32](16), - // ID: to.Ptr[float32](3), - // Manufacturer: to.Ptr("Dell Inc."), - // MemoryInGiB: to.Ptr[float32](256), - // Model: to.Ptr("EMC AX740"), - // OSName: to.Ptr("Azure Stack HCI"), - // OSVersion: to.Ptr("10.0.17777.1061"), - // SerialNumber: to.Ptr("Q44RFC3"), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }}, - // }, - // Status: to.Ptr(armazurestackhci.StatusConnectedRecently), - // TrialDaysRemaining: to.Ptr[float32](30), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/CreateCluster.json -func ExampleClustersClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().Create(ctx, "test-rg", "myCluster", armazurestackhci.Cluster{ - Location: to.Ptr("East US"), - Properties: &armazurestackhci.ClusterProperties{ - AADClientID: to.Ptr("24a6e53d-04e5-44d2-b7cc-1b732a847dfc"), - AADTenantID: to.Ptr("7e589cc1-a8b6-4dff-91bd-5ec0fa18db94"), - CloudManagementEndpoint: to.Ptr("https://98294836-31be-4668-aeae-698667faf99b.waconazure.com"), - }, - }, 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 = armazurestackhci.Cluster{ - // Name: to.Ptr("myCluster"), - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Properties: &armazurestackhci.ClusterProperties{ - // AADClientID: to.Ptr("24a6e53d-04e5-44d2-b7cc-1b732a847dfc"), - // AADTenantID: to.Ptr("7e589cc1-a8b6-4dff-91bd-5ec0fa18db94"), - // BillingModel: to.Ptr("Trial"), - // CloudID: to.Ptr("a3c0468f-e38e-4dda-ac48-817f620536f0"), - // CloudManagementEndpoint: to.Ptr("https://98294836-31be-4668-aeae-698667faf99b.waconazure.com"), - // DesiredProperties: &armazurestackhci.ClusterDesiredProperties{ - // DiagnosticLevel: to.Ptr(armazurestackhci.DiagnosticLevelBasic), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionDisabled), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // ReportedProperties: &armazurestackhci.ClusterReportedProperties{ - // }, - // ServiceEndpoint: to.Ptr("https://azurestackhci.azurefd.net/eastus"), - // Status: to.Ptr(armazurestackhci.StatusNotYetRegistered), - // TrialDaysRemaining: to.Ptr[float32](30), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/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 := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().Update(ctx, "test-rg", "myCluster", armazurestackhci.ClusterPatch{ - Properties: &armazurestackhci.ClusterPatchProperties{ - CloudManagementEndpoint: to.Ptr("https://98294836-31be-4668-aeae-698667faf99b.waconazure.com"), - DesiredProperties: &armazurestackhci.ClusterDesiredProperties{ - DiagnosticLevel: to.Ptr(armazurestackhci.DiagnosticLevelBasic), - WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - }, - }, - 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 = armazurestackhci.Cluster{ - // Name: to.Ptr("myCluster"), - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armazurestackhci.ClusterProperties{ - // AADClientID: to.Ptr("515da1c2-379e-49b4-9975-09e3e40c86be"), - // AADTenantID: to.Ptr("7e589cc1-a8b6-4dff-91bd-5ec0fa18db94"), - // BillingModel: to.Ptr("Trial"), - // CloudID: to.Ptr("91c2b355-4826-4e96-9164-e3f26dcf1cdd"), - // CloudManagementEndpoint: to.Ptr("https://98294836-31be-4668-aeae-698667faf99b.waconazure.com"), - // DesiredProperties: &armazurestackhci.ClusterDesiredProperties{ - // DiagnosticLevel: to.Ptr(armazurestackhci.DiagnosticLevelBasic), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // LastBillingTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T08:12:55.2312022Z"); return t}()), - // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T20:44:32.5625121Z"); return t}()), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // RegistrationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T20:44:32.5625121Z"); return t}()), - // ReportedProperties: &armazurestackhci.ClusterReportedProperties{ - // ClusterID: to.Ptr("a76ac23a-1819-4e82-9410-e3e4ec3d1425"), - // ClusterName: to.Ptr("cluster1"), - // ClusterVersion: to.Ptr("10.0.17777"), - // DiagnosticLevel: to.Ptr(armazurestackhci.DiagnosticLevelBasic), - // ImdsAttestation: to.Ptr(armazurestackhci.ImdsAttestationDisabled), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T19:24:42.1946017Z"); return t}()), - // Nodes: []*armazurestackhci.ClusterNode{ - // { - // Name: to.Ptr("Node1"), - // CoreCount: to.Ptr[float32](8), - // ID: to.Ptr[float32](1), - // Manufacturer: to.Ptr("Dell Inc."), - // MemoryInGiB: to.Ptr[float32](128), - // Model: to.Ptr("EMC AX740"), - // OSName: to.Ptr("Azure Stack HCI"), - // OSVersion: to.Ptr("10.0.17777.1061"), - // SerialNumber: to.Ptr("Q45CZC3"), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // { - // Name: to.Ptr("Node2"), - // CoreCount: to.Ptr[float32](8), - // ID: to.Ptr[float32](2), - // Manufacturer: to.Ptr("Dell Inc."), - // MemoryInGiB: to.Ptr[float32](128), - // Model: to.Ptr("EMC AX740"), - // OSName: to.Ptr("Azure Stack HCI"), - // OSVersion: to.Ptr("10.0.17777.1061"), - // SerialNumber: to.Ptr("Q44BSC3"), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }, - // { - // Name: to.Ptr("Node3"), - // CoreCount: to.Ptr[float32](16), - // ID: to.Ptr[float32](3), - // Manufacturer: to.Ptr("Dell Inc."), - // MemoryInGiB: to.Ptr[float32](256), - // Model: to.Ptr("EMC AX740"), - // OSName: to.Ptr("Azure Stack HCI"), - // OSVersion: to.Ptr("10.0.17777.1061"), - // SerialNumber: to.Ptr("Q44RFC3"), - // WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - // }}, - // }, - // Status: to.Ptr(armazurestackhci.StatusConnectedRecently), - // TrialDaysRemaining: to.Ptr[float32](30), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/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 := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginDelete(ctx, "test-rg", "myCluster", 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/UploadCertificate.json -func ExampleClustersClient_BeginUploadCertificate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginUploadCertificate(ctx, "test-rg", "myCluster", armazurestackhci.UploadCertificateRequest{ - Properties: &armazurestackhci.RawCertificateData{ - Certificates: []*string{ - to.Ptr("base64cert"), - to.Ptr("base64cert")}, - }, - }, 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/CreateClusterIdentity.json -func ExampleClustersClient_BeginCreateIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreateIdentity(ctx, "test-rg", "myCluster", 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.ClusterIdentityResponse = armazurestackhci.ClusterIdentityResponse{ - // Properties: &armazurestackhci.ClusterIdentityResponseProperties{ - // AADApplicationObjectID: to.Ptr("00cc4014-482e-4de9-9932-83415cc75f45"), - // AADClientID: to.Ptr("7b93bf67-60ac-4909-a987-ac438e69f9ba"), - // AADServicePrincipalObjectID: to.Ptr("400bd05f-395f-45a6-ba75-72601df80107"), - // AADTenantID: to.Ptr("bdb2c88c-9cfd-4e19-927d-51e875f6912b"), - // }, - // } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go index 727647d04066..ec273b200c10 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go @@ -3,15 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armazurestackhci const ( moduleName = "armazurestackhci" - moduleVersion = "v1.1.1" + moduleVersion = "v2.0.0-beta.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -28,45 +27,19 @@ func PossibleActionTypeValues() []ActionType { } } -// ArcSettingAggregateState - Aggregate state of Arc agent across the nodes in this HCI cluster. -type ArcSettingAggregateState string +// CloudInitDataSource - Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] +type CloudInitDataSource string const ( - ArcSettingAggregateStateCanceled ArcSettingAggregateState = "Canceled" - ArcSettingAggregateStateConnected ArcSettingAggregateState = "Connected" - ArcSettingAggregateStateCreating ArcSettingAggregateState = "Creating" - ArcSettingAggregateStateDeleted ArcSettingAggregateState = "Deleted" - ArcSettingAggregateStateDeleting ArcSettingAggregateState = "Deleting" - ArcSettingAggregateStateDisconnected ArcSettingAggregateState = "Disconnected" - ArcSettingAggregateStateError ArcSettingAggregateState = "Error" - ArcSettingAggregateStateFailed ArcSettingAggregateState = "Failed" - ArcSettingAggregateStateInProgress ArcSettingAggregateState = "InProgress" - ArcSettingAggregateStateMoving ArcSettingAggregateState = "Moving" - ArcSettingAggregateStateNotSpecified ArcSettingAggregateState = "NotSpecified" - ArcSettingAggregateStatePartiallyConnected ArcSettingAggregateState = "PartiallyConnected" - ArcSettingAggregateStatePartiallySucceeded ArcSettingAggregateState = "PartiallySucceeded" - ArcSettingAggregateStateSucceeded ArcSettingAggregateState = "Succeeded" - ArcSettingAggregateStateUpdating ArcSettingAggregateState = "Updating" + CloudInitDataSourceAzure CloudInitDataSource = "Azure" + CloudInitDataSourceNoCloud CloudInitDataSource = "NoCloud" ) -// PossibleArcSettingAggregateStateValues returns the possible values for the ArcSettingAggregateState const type. -func PossibleArcSettingAggregateStateValues() []ArcSettingAggregateState { - return []ArcSettingAggregateState{ - ArcSettingAggregateStateCanceled, - ArcSettingAggregateStateConnected, - ArcSettingAggregateStateCreating, - ArcSettingAggregateStateDeleted, - ArcSettingAggregateStateDeleting, - ArcSettingAggregateStateDisconnected, - ArcSettingAggregateStateError, - ArcSettingAggregateStateFailed, - ArcSettingAggregateStateInProgress, - ArcSettingAggregateStateMoving, - ArcSettingAggregateStateNotSpecified, - ArcSettingAggregateStatePartiallyConnected, - ArcSettingAggregateStatePartiallySucceeded, - ArcSettingAggregateStateSucceeded, - ArcSettingAggregateStateUpdating, +// PossibleCloudInitDataSourceValues returns the possible values for the CloudInitDataSource const type. +func PossibleCloudInitDataSourceValues() []CloudInitDataSource { + return []CloudInitDataSource{ + CloudInitDataSourceAzure, + CloudInitDataSourceNoCloud, } } @@ -90,151 +63,97 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// DiagnosticLevel - Desired level of diagnostic data emitted by the cluster. -type DiagnosticLevel string +// DiskFileFormat - The format of the actual VHD file [vhd, vhdx] +type DiskFileFormat string const ( - DiagnosticLevelBasic DiagnosticLevel = "Basic" - DiagnosticLevelEnhanced DiagnosticLevel = "Enhanced" - DiagnosticLevelOff DiagnosticLevel = "Off" + DiskFileFormatVhd DiskFileFormat = "vhd" + DiskFileFormatVhdx DiskFileFormat = "vhdx" ) -// PossibleDiagnosticLevelValues returns the possible values for the DiagnosticLevel const type. -func PossibleDiagnosticLevelValues() []DiagnosticLevel { - return []DiagnosticLevel{ - DiagnosticLevelBasic, - DiagnosticLevelEnhanced, - DiagnosticLevelOff, +// PossibleDiskFileFormatValues returns the possible values for the DiskFileFormat const type. +func PossibleDiskFileFormatValues() []DiskFileFormat { + return []DiskFileFormat{ + DiskFileFormatVhd, + DiskFileFormatVhdx, } } -// ExtensionAggregateState - Aggregate state of Arc Extensions across the nodes in this HCI cluster. -type ExtensionAggregateState string +// ExtendedLocationTypes - The type of extendedLocation. +type ExtendedLocationTypes string const ( - ExtensionAggregateStateCanceled ExtensionAggregateState = "Canceled" - ExtensionAggregateStateConnected ExtensionAggregateState = "Connected" - ExtensionAggregateStateCreating ExtensionAggregateState = "Creating" - ExtensionAggregateStateDeleted ExtensionAggregateState = "Deleted" - ExtensionAggregateStateDeleting ExtensionAggregateState = "Deleting" - ExtensionAggregateStateDisconnected ExtensionAggregateState = "Disconnected" - ExtensionAggregateStateError ExtensionAggregateState = "Error" - ExtensionAggregateStateFailed ExtensionAggregateState = "Failed" - ExtensionAggregateStateInProgress ExtensionAggregateState = "InProgress" - ExtensionAggregateStateMoving ExtensionAggregateState = "Moving" - ExtensionAggregateStateNotSpecified ExtensionAggregateState = "NotSpecified" - ExtensionAggregateStatePartiallyConnected ExtensionAggregateState = "PartiallyConnected" - ExtensionAggregateStatePartiallySucceeded ExtensionAggregateState = "PartiallySucceeded" - ExtensionAggregateStateSucceeded ExtensionAggregateState = "Succeeded" - ExtensionAggregateStateUpdating ExtensionAggregateState = "Updating" + ExtendedLocationTypesCustomLocation ExtendedLocationTypes = "CustomLocation" ) -// PossibleExtensionAggregateStateValues returns the possible values for the ExtensionAggregateState const type. -func PossibleExtensionAggregateStateValues() []ExtensionAggregateState { - return []ExtensionAggregateState{ - ExtensionAggregateStateCanceled, - ExtensionAggregateStateConnected, - ExtensionAggregateStateCreating, - ExtensionAggregateStateDeleted, - ExtensionAggregateStateDeleting, - ExtensionAggregateStateDisconnected, - ExtensionAggregateStateError, - ExtensionAggregateStateFailed, - ExtensionAggregateStateInProgress, - ExtensionAggregateStateMoving, - ExtensionAggregateStateNotSpecified, - ExtensionAggregateStatePartiallyConnected, - ExtensionAggregateStatePartiallySucceeded, - ExtensionAggregateStateSucceeded, - ExtensionAggregateStateUpdating, +// PossibleExtendedLocationTypesValues returns the possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ + ExtendedLocationTypesCustomLocation, } } -// ImdsAttestation - IMDS attestation status of the cluster. -type ImdsAttestation string +// HyperVGeneration - The hypervisor generation of the Virtual Machine [V1, V2] +type HyperVGeneration string const ( - ImdsAttestationDisabled ImdsAttestation = "Disabled" - ImdsAttestationEnabled ImdsAttestation = "Enabled" + HyperVGenerationV1 HyperVGeneration = "V1" + HyperVGenerationV2 HyperVGeneration = "V2" ) -// PossibleImdsAttestationValues returns the possible values for the ImdsAttestation const type. -func PossibleImdsAttestationValues() []ImdsAttestation { - return []ImdsAttestation{ - ImdsAttestationDisabled, - ImdsAttestationEnabled, +// PossibleHyperVGenerationValues returns the possible values for the HyperVGeneration const type. +func PossibleHyperVGenerationValues() []HyperVGeneration { + return []HyperVGeneration{ + HyperVGenerationV1, + HyperVGenerationV2, } } -// NodeArcState - State of Arc agent in this node. -type NodeArcState string +// IPAllocationMethodEnum - IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' +type IPAllocationMethodEnum string const ( - NodeArcStateCanceled NodeArcState = "Canceled" - NodeArcStateConnected NodeArcState = "Connected" - NodeArcStateCreating NodeArcState = "Creating" - NodeArcStateDeleted NodeArcState = "Deleted" - NodeArcStateDeleting NodeArcState = "Deleting" - NodeArcStateDisconnected NodeArcState = "Disconnected" - NodeArcStateError NodeArcState = "Error" - NodeArcStateFailed NodeArcState = "Failed" - NodeArcStateMoving NodeArcState = "Moving" - NodeArcStateNotSpecified NodeArcState = "NotSpecified" - NodeArcStateSucceeded NodeArcState = "Succeeded" - NodeArcStateUpdating NodeArcState = "Updating" + IPAllocationMethodEnumDynamic IPAllocationMethodEnum = "Dynamic" + IPAllocationMethodEnumStatic IPAllocationMethodEnum = "Static" ) -// PossibleNodeArcStateValues returns the possible values for the NodeArcState const type. -func PossibleNodeArcStateValues() []NodeArcState { - return []NodeArcState{ - NodeArcStateCanceled, - NodeArcStateConnected, - NodeArcStateCreating, - NodeArcStateDeleted, - NodeArcStateDeleting, - NodeArcStateDisconnected, - NodeArcStateError, - NodeArcStateFailed, - NodeArcStateMoving, - NodeArcStateNotSpecified, - NodeArcStateSucceeded, - NodeArcStateUpdating, +// PossibleIPAllocationMethodEnumValues returns the possible values for the IPAllocationMethodEnum const type. +func PossibleIPAllocationMethodEnumValues() []IPAllocationMethodEnum { + return []IPAllocationMethodEnum{ + IPAllocationMethodEnumDynamic, + IPAllocationMethodEnumStatic, } } -// NodeExtensionState - State of Arc Extension in this node. -type NodeExtensionState string +// IPPoolTypeEnum - Type of the IP Pool [vm, vippool] +type IPPoolTypeEnum string const ( - NodeExtensionStateCanceled NodeExtensionState = "Canceled" - NodeExtensionStateConnected NodeExtensionState = "Connected" - NodeExtensionStateCreating NodeExtensionState = "Creating" - NodeExtensionStateDeleted NodeExtensionState = "Deleted" - NodeExtensionStateDeleting NodeExtensionState = "Deleting" - NodeExtensionStateDisconnected NodeExtensionState = "Disconnected" - NodeExtensionStateError NodeExtensionState = "Error" - NodeExtensionStateFailed NodeExtensionState = "Failed" - NodeExtensionStateMoving NodeExtensionState = "Moving" - NodeExtensionStateNotSpecified NodeExtensionState = "NotSpecified" - NodeExtensionStateSucceeded NodeExtensionState = "Succeeded" - NodeExtensionStateUpdating NodeExtensionState = "Updating" + IPPoolTypeEnumVM IPPoolTypeEnum = "vm" + IPPoolTypeEnumVippool IPPoolTypeEnum = "vippool" ) -// PossibleNodeExtensionStateValues returns the possible values for the NodeExtensionState const type. -func PossibleNodeExtensionStateValues() []NodeExtensionState { - return []NodeExtensionState{ - NodeExtensionStateCanceled, - NodeExtensionStateConnected, - NodeExtensionStateCreating, - NodeExtensionStateDeleted, - NodeExtensionStateDeleting, - NodeExtensionStateDisconnected, - NodeExtensionStateError, - NodeExtensionStateFailed, - NodeExtensionStateMoving, - NodeExtensionStateNotSpecified, - NodeExtensionStateSucceeded, - NodeExtensionStateUpdating, +// PossibleIPPoolTypeEnumValues returns the possible values for the IPPoolTypeEnum const type. +func PossibleIPPoolTypeEnumValues() []IPPoolTypeEnum { + return []IPPoolTypeEnum{ + IPPoolTypeEnumVM, + IPPoolTypeEnumVippool, + } +} + +// OperatingSystemTypes - Operating system type that the gallery image uses [Windows, Linux] +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +// PossibleOperatingSystemTypesValues returns the possible values for the OperatingSystemTypes const type. +func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { + return []OperatingSystemTypes{ + OperatingSystemTypesLinux, + OperatingSystemTypesWindows, } } @@ -257,62 +176,198 @@ func PossibleOriginValues() []Origin { } } -// ProvisioningState - Provisioning state of the ArcSetting proxy resource. -type ProvisioningState string +// PowerStateEnum - The power state of the virtual machine instance +type PowerStateEnum string + +const ( + PowerStateEnumDeallocated PowerStateEnum = "Deallocated" + PowerStateEnumDeallocating PowerStateEnum = "Deallocating" + PowerStateEnumRunning PowerStateEnum = "Running" + PowerStateEnumStarting PowerStateEnum = "Starting" + PowerStateEnumStopped PowerStateEnum = "Stopped" + PowerStateEnumStopping PowerStateEnum = "Stopping" + PowerStateEnumUnknown PowerStateEnum = "Unknown" +) + +// PossiblePowerStateEnumValues returns the possible values for the PowerStateEnum const type. +func PossiblePowerStateEnumValues() []PowerStateEnum { + return []PowerStateEnum{ + PowerStateEnumDeallocated, + PowerStateEnumDeallocating, + PowerStateEnumRunning, + PowerStateEnumStarting, + PowerStateEnumStopped, + PowerStateEnumStopping, + PowerStateEnumUnknown, + } +} + +// ProvisioningAction - Defines the different types of operations for guest agent. +type ProvisioningAction string + +const ( + ProvisioningActionInstall ProvisioningAction = "install" + ProvisioningActionRepair ProvisioningAction = "repair" + ProvisioningActionUninstall ProvisioningAction = "uninstall" +) + +// PossibleProvisioningActionValues returns the possible values for the ProvisioningAction const type. +func PossibleProvisioningActionValues() []ProvisioningAction { + return []ProvisioningAction{ + ProvisioningActionInstall, + ProvisioningActionRepair, + ProvisioningActionUninstall, + } +} + +// ProvisioningStateEnum - Provisioning state of the gallery image. +type ProvisioningStateEnum string const ( - ProvisioningStateAccepted ProvisioningState = "Accepted" - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateProvisioning ProvisioningState = "Provisioning" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateEnumAccepted ProvisioningStateEnum = "Accepted" + ProvisioningStateEnumCanceled ProvisioningStateEnum = "Canceled" + ProvisioningStateEnumDeleting ProvisioningStateEnum = "Deleting" + ProvisioningStateEnumFailed ProvisioningStateEnum = "Failed" + ProvisioningStateEnumInProgress ProvisioningStateEnum = "InProgress" + ProvisioningStateEnumSucceeded ProvisioningStateEnum = "Succeeded" ) -// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ - ProvisioningStateAccepted, - ProvisioningStateCanceled, - ProvisioningStateFailed, - ProvisioningStateProvisioning, - ProvisioningStateSucceeded, +// PossibleProvisioningStateEnumValues returns the possible values for the ProvisioningStateEnum const type. +func PossibleProvisioningStateEnumValues() []ProvisioningStateEnum { + return []ProvisioningStateEnum{ + ProvisioningStateEnumAccepted, + ProvisioningStateEnumCanceled, + ProvisioningStateEnumDeleting, + ProvisioningStateEnumFailed, + ProvisioningStateEnumInProgress, + ProvisioningStateEnumSucceeded, } } -// Status - Status of the cluster agent. +// SecurityTypes - Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true +// for SecurityType to function. +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +// PossibleSecurityTypesValues returns the possible values for the SecurityTypes const type. +func PossibleSecurityTypesValues() []SecurityTypes { + return []SecurityTypes{ + SecurityTypesConfidentialVM, + SecurityTypesTrustedLaunch, + } +} + +// Status - The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] type Status string const ( - StatusConnectedRecently Status = "ConnectedRecently" - StatusDisconnected Status = "Disconnected" - StatusError Status = "Error" - StatusNotConnectedRecently Status = "NotConnectedRecently" - StatusNotYetRegistered Status = "NotYetRegistered" + StatusFailed Status = "Failed" + StatusInProgress Status = "InProgress" + StatusSucceeded Status = "Succeeded" ) // PossibleStatusValues returns the possible values for the Status const type. func PossibleStatusValues() []Status { return []Status{ - StatusConnectedRecently, - StatusDisconnected, - StatusError, - StatusNotConnectedRecently, - StatusNotYetRegistered, + StatusFailed, + StatusInProgress, + StatusSucceeded, + } +} + +// 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 installation status of the hybrid machine agent installation. +type StatusTypes string + +const ( + StatusTypesFailed StatusTypes = "Failed" + StatusTypesInProgress StatusTypes = "InProgress" + StatusTypesSucceeded StatusTypes = "Succeeded" +) + +// PossibleStatusTypesValues returns the possible values for the StatusTypes const type. +func PossibleStatusTypesValues() []StatusTypes { + return []StatusTypes{ + StatusTypesFailed, + StatusTypesInProgress, + StatusTypesSucceeded, } } -// WindowsServerSubscription - Desired state of Windows Server Subscription. -type WindowsServerSubscription string +type VMSizeEnum string const ( - WindowsServerSubscriptionDisabled WindowsServerSubscription = "Disabled" - WindowsServerSubscriptionEnabled WindowsServerSubscription = "Enabled" + VMSizeEnumCustom VMSizeEnum = "Custom" + VMSizeEnumDefault VMSizeEnum = "Default" + VMSizeEnumStandardA2V2 VMSizeEnum = "Standard_A2_v2" + VMSizeEnumStandardA4V2 VMSizeEnum = "Standard_A4_v2" + VMSizeEnumStandardD16SV3 VMSizeEnum = "Standard_D16s_v3" + VMSizeEnumStandardD2SV3 VMSizeEnum = "Standard_D2s_v3" + VMSizeEnumStandardD32SV3 VMSizeEnum = "Standard_D32s_v3" + VMSizeEnumStandardD4SV3 VMSizeEnum = "Standard_D4s_v3" + VMSizeEnumStandardD8SV3 VMSizeEnum = "Standard_D8s_v3" + VMSizeEnumStandardDS13V2 VMSizeEnum = "Standard_DS13_v2" + VMSizeEnumStandardDS2V2 VMSizeEnum = "Standard_DS2_v2" + VMSizeEnumStandardDS3V2 VMSizeEnum = "Standard_DS3_v2" + VMSizeEnumStandardDS4V2 VMSizeEnum = "Standard_DS4_v2" + VMSizeEnumStandardDS5V2 VMSizeEnum = "Standard_DS5_v2" + VMSizeEnumStandardK8S2V1 VMSizeEnum = "Standard_K8S2_v1" + VMSizeEnumStandardK8S3V1 VMSizeEnum = "Standard_K8S3_v1" + VMSizeEnumStandardK8S4V1 VMSizeEnum = "Standard_K8S4_v1" + VMSizeEnumStandardK8S5V1 VMSizeEnum = "Standard_K8S5_v1" + VMSizeEnumStandardK8SV1 VMSizeEnum = "Standard_K8S_v1" + VMSizeEnumStandardNK12 VMSizeEnum = "Standard_NK12" + VMSizeEnumStandardNK6 VMSizeEnum = "Standard_NK6" + VMSizeEnumStandardNV12 VMSizeEnum = "Standard_NV12" + VMSizeEnumStandardNV6 VMSizeEnum = "Standard_NV6" ) -// PossibleWindowsServerSubscriptionValues returns the possible values for the WindowsServerSubscription const type. -func PossibleWindowsServerSubscriptionValues() []WindowsServerSubscription { - return []WindowsServerSubscription{ - WindowsServerSubscriptionDisabled, - WindowsServerSubscriptionEnabled, +// PossibleVMSizeEnumValues returns the possible values for the VMSizeEnum const type. +func PossibleVMSizeEnumValues() []VMSizeEnum { + return []VMSizeEnum{ + VMSizeEnumCustom, + VMSizeEnumDefault, + VMSizeEnumStandardA2V2, + VMSizeEnumStandardA4V2, + VMSizeEnumStandardD16SV3, + VMSizeEnumStandardD2SV3, + VMSizeEnumStandardD32SV3, + VMSizeEnumStandardD4SV3, + VMSizeEnumStandardD8SV3, + VMSizeEnumStandardDS13V2, + VMSizeEnumStandardDS2V2, + VMSizeEnumStandardDS3V2, + VMSizeEnumStandardDS4V2, + VMSizeEnumStandardDS5V2, + VMSizeEnumStandardK8S2V1, + VMSizeEnumStandardK8S3V1, + VMSizeEnumStandardK8S4V1, + VMSizeEnumStandardK8S5V1, + VMSizeEnumStandardK8SV1, + VMSizeEnumStandardNK12, + VMSizeEnumStandardNK6, + VMSizeEnumStandardNV12, + VMSizeEnumStandardNV6, } } diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client.go deleted file mode 100644 index 169d0214fe33..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client.go +++ /dev/null @@ -1,417 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armazurestackhci - -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" -) - -// ExtensionsClient contains the methods for the Extensions group. -// Don't use this type directly, use NewExtensionsClient() instead. -type ExtensionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewExtensionsClient creates a new instance of ExtensionsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExtensionsClient, error) { - cl, err := arm.NewClient(moduleName+".ExtensionsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ExtensionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreate - Create Extension for HCI cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. -// - extensionName - The name of the machine extension. -// - extension - Details of the Machine Extension to be created. -// - options - ExtensionsClientBeginCreateOptions contains the optional parameters for the ExtensionsClient.BeginCreate method. -func (client *ExtensionsClient) BeginCreate(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension, options *ExtensionsClientBeginCreateOptions) (*runtime.Poller[ExtensionsClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extension, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtensionsClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[ExtensionsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - Create Extension for HCI cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -func (client *ExtensionsClient) create(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension, options *ExtensionsClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extension, 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 *ExtensionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension, options *ExtensionsClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/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 clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if arcSettingName == "" { - return nil, errors.New("parameter arcSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, extension) -} - -// BeginDelete - Delete particular Arc Extension of HCI Cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. -// - extensionName - The name of the machine extension. -// - options - ExtensionsClientBeginDeleteOptions contains the optional parameters for the ExtensionsClient.BeginDelete method. -func (client *ExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *ExtensionsClientBeginDeleteOptions) (*runtime.Poller[ExtensionsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtensionsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[ExtensionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Delete particular Arc Extension of HCI Cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -func (client *ExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *ExtensionsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, 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 *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *ExtensionsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/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 clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if arcSettingName == "" { - return nil, errors.New("parameter arcSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get particular Arc Extension of HCI Cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. -// - extensionName - The name of the machine extension. -// - options - ExtensionsClientGetOptions contains the optional parameters for the ExtensionsClient.Get method. -func (client *ExtensionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *ExtensionsClientGetOptions) (ExtensionsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, options) - if err != nil { - return ExtensionsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ExtensionsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExtensionsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *ExtensionsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/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 clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if arcSettingName == "" { - return nil, errors.New("parameter arcSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ExtensionsClient) getHandleResponse(resp *http.Response) (ExtensionsClientGetResponse, error) { - result := ExtensionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Extension); err != nil { - return ExtensionsClientGetResponse{}, err - } - return result, nil -} - -// NewListByArcSettingPager - List all Extensions under ArcSetting resource. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. -// - options - ExtensionsClientListByArcSettingOptions contains the optional parameters for the ExtensionsClient.NewListByArcSettingPager -// method. -func (client *ExtensionsClient) NewListByArcSettingPager(resourceGroupName string, clusterName string, arcSettingName string, options *ExtensionsClientListByArcSettingOptions) *runtime.Pager[ExtensionsClientListByArcSettingResponse] { - return runtime.NewPager(runtime.PagingHandler[ExtensionsClientListByArcSettingResponse]{ - More: func(page ExtensionsClientListByArcSettingResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ExtensionsClientListByArcSettingResponse) (ExtensionsClientListByArcSettingResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByArcSettingCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ExtensionsClientListByArcSettingResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ExtensionsClientListByArcSettingResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExtensionsClientListByArcSettingResponse{}, runtime.NewResponseError(resp) - } - return client.listByArcSettingHandleResponse(resp) - }, - }) -} - -// listByArcSettingCreateRequest creates the ListByArcSetting request. -func (client *ExtensionsClient) listByArcSettingCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ExtensionsClientListByArcSettingOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/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 clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if arcSettingName == "" { - return nil, errors.New("parameter arcSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByArcSettingHandleResponse handles the ListByArcSetting response. -func (client *ExtensionsClient) listByArcSettingHandleResponse(resp *http.Response) (ExtensionsClientListByArcSettingResponse, error) { - result := ExtensionsClientListByArcSettingResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExtensionList); err != nil { - return ExtensionsClientListByArcSettingResponse{}, err - } - return result, nil -} - -// BeginUpdate - Update Extension for HCI cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - clusterName - The name of the cluster. -// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. -// - extensionName - The name of the machine extension. -// - extension - Details of the Machine Extension to be created. -// - options - ExtensionsClientBeginUpdateOptions contains the optional parameters for the ExtensionsClient.BeginUpdate method. -func (client *ExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension, options *ExtensionsClientBeginUpdateOptions) (*runtime.Poller[ExtensionsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extension, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtensionsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaOriginalURI, - }) - } else { - return runtime.NewPollerFromResumeToken[ExtensionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Update - Update Extension for HCI cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -func (client *ExtensionsClient) update(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension, options *ExtensionsClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extension, 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 -} - -// updateCreateRequest creates the Update request. -func (client *ExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension, options *ExtensionsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/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 clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if arcSettingName == "" { - return nil, errors.New("parameter arcSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, extension) -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client_example_test.go deleted file mode 100644 index d377e41b8e94..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client_example_test.go +++ /dev/null @@ -1,346 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armazurestackhci_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/azurestackhci/armazurestackhci" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/ListExtensionsByArcSetting.json -func ExampleExtensionsClient_NewListByArcSettingPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExtensionsClient().NewListByArcSettingPager("test-rg", "myCluster", "default", 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.ExtensionList = armazurestackhci.ExtensionList{ - // Value: []*armazurestackhci.Extension{ - // { - // Name: to.Ptr("MicrosoftMonitoringAgent"), - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters/arcSettings/extensions"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster/arcSettings/default/extensions/MicrosoftMonitoringAgent"), - // Properties: &armazurestackhci.ExtensionProperties{ - // AggregateState: to.Ptr(armazurestackhci.ExtensionAggregateStatePartiallyConnected), - // ExtensionParameters: &armazurestackhci.ExtensionParameters{ - // Type: to.Ptr("string"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // "workspaceId": "xx", - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // PerNodeExtensionDetails: []*armazurestackhci.PerNodeExtensionState{ - // { - // Name: to.Ptr("Node-1"), - // Extension: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-1/Extensions/MicrosoftMonitoringAgent"), - // State: to.Ptr(armazurestackhci.NodeExtensionStateConnected), - // }, - // { - // Name: to.Ptr("Node-2"), - // Extension: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-2/Extensions/MicrosoftMonitoringAgent"), - // State: to.Ptr(armazurestackhci.NodeExtensionStateDisconnected), - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters/arcSettings/extensions"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster/arcSettings/default/Extensions/SecurityExtension"), - // Properties: &armazurestackhci.ExtensionProperties{ - // AggregateState: to.Ptr(armazurestackhci.ExtensionAggregateStatePartiallySucceeded), - // ExtensionParameters: &armazurestackhci.ExtensionParameters{ - // Type: to.Ptr("string"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // Publisher: to.Ptr("Microsoft.CustomScriptExtension"), - // Settings: map[string]any{ - // "scriptLocation": "xx", - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // PerNodeExtensionDetails: []*armazurestackhci.PerNodeExtensionState{ - // { - // Name: to.Ptr("Node-1"), - // Extension: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-1/Extensions/SecurityExtension"), - // State: to.Ptr(armazurestackhci.NodeExtensionStateSucceeded), - // }, - // { - // Name: to.Ptr("Node-2"), - // Extension: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-2/Extensions/SecurityExtension"), - // State: to.Ptr(armazurestackhci.NodeExtensionStateFailed), - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/GetExtension.json -func ExampleExtensionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExtensionsClient().Get(ctx, "test-rg", "myCluster", "default", "MicrosoftMonitoringAgent", 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.Extension = armazurestackhci.Extension{ - // Name: to.Ptr("MicrosoftMonitoringAgent"), - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters/arcSettings/extensions"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster/arcSettings/default/extensions/MicrosoftMonitoringAgent"), - // Properties: &armazurestackhci.ExtensionProperties{ - // AggregateState: to.Ptr(armazurestackhci.ExtensionAggregateStatePartiallySucceeded), - // ExtensionParameters: &armazurestackhci.ExtensionParameters{ - // Type: to.Ptr("string"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // "workspaceId": "xx", - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // PerNodeExtensionDetails: []*armazurestackhci.PerNodeExtensionState{ - // { - // Name: to.Ptr("Node-1"), - // Extension: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-1/Extensions/MicrosoftMonitoringAgent"), - // State: to.Ptr(armazurestackhci.NodeExtensionStateSucceeded), - // }, - // { - // Name: to.Ptr("Node-2"), - // Extension: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-2/Extensions/MicrosoftMonitoringAgent"), - // State: to.Ptr(armazurestackhci.NodeExtensionStateFailed), - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/PutExtension.json -func ExampleExtensionsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginCreate(ctx, "test-rg", "myCluster", "default", "MicrosoftMonitoringAgent", armazurestackhci.Extension{ - Properties: &armazurestackhci.ExtensionProperties{ - ExtensionParameters: &armazurestackhci.ExtensionParameters{ - Type: to.Ptr("MicrosoftMonitoringAgent"), - ProtectedSettings: map[string]any{ - "workspaceKey": "xx", - }, - Publisher: to.Ptr("Microsoft.Compute"), - Settings: map[string]any{ - "workspaceId": "xx", - }, - 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.Extension = armazurestackhci.Extension{ - // Name: to.Ptr("MicrosoftMonitoringAgent"), - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters/arcSettings/extensions"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster/arcSettings/default/extensions/MicrosoftMonitoringAgent"), - // Properties: &armazurestackhci.ExtensionProperties{ - // AggregateState: to.Ptr(armazurestackhci.ExtensionAggregateStatePartiallySucceeded), - // ExtensionParameters: &armazurestackhci.ExtensionParameters{ - // Type: to.Ptr("string"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // "workspaceId": "xx", - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // PerNodeExtensionDetails: []*armazurestackhci.PerNodeExtensionState{ - // { - // Name: to.Ptr("Node-1"), - // Extension: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-1/Extensions/MicrosoftMonitoringAgent"), - // State: to.Ptr(armazurestackhci.NodeExtensionStateSucceeded), - // }, - // { - // Name: to.Ptr("Node-2"), - // Extension: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-2/Extensions/MicrosoftMonitoringAgent"), - // State: to.Ptr(armazurestackhci.NodeExtensionStateFailed), - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/PatchExtension.json -func ExampleExtensionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginUpdate(ctx, "test-rg", "myCluster", "default", "MicrosoftMonitoringAgent", armazurestackhci.Extension{ - Properties: &armazurestackhci.ExtensionProperties{ - ExtensionParameters: &armazurestackhci.ExtensionParameters{ - Type: to.Ptr("MicrosoftMonitoringAgent"), - Publisher: to.Ptr("Microsoft.Compute"), - Settings: map[string]any{ - "workspaceId": "xx", - }, - 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.Extension = armazurestackhci.Extension{ - // Name: to.Ptr("MicrosoftMonitoringAgent"), - // Type: to.Ptr("Microsoft.AzureStackHCI/clusters/arcSettings/extensions"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/clusters/myCluster/arcSettings/default/extensions/MicrosoftMonitoringAgent"), - // Properties: &armazurestackhci.ExtensionProperties{ - // AggregateState: to.Ptr(armazurestackhci.ExtensionAggregateStatePartiallyConnected), - // ExtensionParameters: &armazurestackhci.ExtensionParameters{ - // Type: to.Ptr("string"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // "workspaceId": "xx", - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // PerNodeExtensionDetails: []*armazurestackhci.PerNodeExtensionState{ - // { - // Name: to.Ptr("Node-1"), - // Extension: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-1/Extensions/MicrosoftMonitoringAgent"), - // State: to.Ptr(armazurestackhci.NodeExtensionStateConnected), - // }, - // { - // Name: to.Ptr("Node-2"), - // Extension: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/ArcInstance-rg/providers/Microsoft.HybridCompute/machines/Node-2/Extensions/MicrosoftMonitoringAgent"), - // State: to.Ptr(armazurestackhci.NodeExtensionStateDisconnected), - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateSucceeded), - // }, - // SystemData: &armazurestackhci.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurestackhci.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/DeleteExtension.json -func ExampleExtensionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginDelete(ctx, "test-rg", "myCluster", "default", "MicrosoftMonitoringAgent", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client.go new file mode 100644 index 000000000000..1424dc54e122 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client.go @@ -0,0 +1,448 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurestackhci + +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" +) + +// GalleryImagesClient contains the methods for the GalleryImages group. +// Don't use this type directly, use NewGalleryImagesClient() instead. +type GalleryImagesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewGalleryImagesClient creates a new instance of GalleryImagesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGalleryImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryImagesClient, error) { + cl, err := arm.NewClient(moduleName+".GalleryImagesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GalleryImagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a gallery image. Please note some properties can be set only during +// gallery image creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - galleryImageName - Name of the gallery image +// - options - GalleryImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginCreateOrUpdate +// method. +func (client *GalleryImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryImageName string, galleryImages GalleryImages, options *GalleryImagesClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryImagesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, galleryImageName, galleryImages, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryImagesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[GalleryImagesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - The operation to create or update a gallery image. Please note some properties can be set only during +// gallery image creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *GalleryImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryImageName string, galleryImages GalleryImages, options *GalleryImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryImageName, galleryImages, 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 *GalleryImagesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryImageName string, galleryImages GalleryImages, options *GalleryImagesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + 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 galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, galleryImages); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete a gallery image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - galleryImageName - Name of the gallery image +// - options - GalleryImagesClientBeginDeleteOptions contains the optional parameters for the GalleryImagesClient.BeginDelete +// method. +func (client *GalleryImagesClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryImageName string, options *GalleryImagesClientBeginDeleteOptions) (*runtime.Poller[GalleryImagesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, galleryImageName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryImagesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[GalleryImagesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - The operation to delete a gallery image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *GalleryImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryImageName string, options *GalleryImagesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryImageName, 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 *GalleryImagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryImageName string, options *GalleryImagesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + 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 galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a gallery image +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - galleryImageName - Name of the gallery image +// - options - GalleryImagesClientGetOptions contains the optional parameters for the GalleryImagesClient.Get method. +func (client *GalleryImagesClient) Get(ctx context.Context, resourceGroupName string, galleryImageName string, options *GalleryImagesClientGetOptions) (GalleryImagesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, galleryImageName, options) + if err != nil { + return GalleryImagesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GalleryImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GalleryImagesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *GalleryImagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryImageName string, options *GalleryImagesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + 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 galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GalleryImagesClient) getHandleResponse(resp *http.Response) (GalleryImagesClientGetResponse, error) { + result := GalleryImagesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImages); err != nil { + return GalleryImagesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all of the gallery images in the specified resource group. Use the nextLink property in the response +// to get the next page of gallery images. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - GalleryImagesClientListOptions contains the optional parameters for the GalleryImagesClient.NewListPager method. +func (client *GalleryImagesClient) NewListPager(resourceGroupName string, options *GalleryImagesClientListOptions) *runtime.Pager[GalleryImagesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[GalleryImagesClientListResponse]{ + More: func(page GalleryImagesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GalleryImagesClientListResponse) (GalleryImagesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GalleryImagesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GalleryImagesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryImagesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *GalleryImagesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *GalleryImagesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages" + 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", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *GalleryImagesClient) listHandleResponse(resp *http.Response) (GalleryImagesClientListResponse, error) { + result := GalleryImagesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImagesListResult); err != nil { + return GalleryImagesClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Lists all of the gallery images in the specified subscription. Use the nextLink property in the response +// to get the next page of gallery images. +// +// Generated from API version 2023-09-01-preview +// - options - GalleryImagesClientListAllOptions contains the optional parameters for the GalleryImagesClient.NewListAllPager +// method. +func (client *GalleryImagesClient) NewListAllPager(options *GalleryImagesClientListAllOptions) *runtime.Pager[GalleryImagesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[GalleryImagesClientListAllResponse]{ + More: func(page GalleryImagesClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GalleryImagesClientListAllResponse) (GalleryImagesClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GalleryImagesClientListAllResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GalleryImagesClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryImagesClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *GalleryImagesClient) listAllCreateRequest(ctx context.Context, options *GalleryImagesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryImages" + 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", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *GalleryImagesClient) listAllHandleResponse(resp *http.Response) (GalleryImagesClientListAllResponse, error) { + result := GalleryImagesClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImagesListResult); err != nil { + return GalleryImagesClientListAllResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update a gallery image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - galleryImageName - Name of the gallery image +// - options - GalleryImagesClientBeginUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginUpdate +// method. +func (client *GalleryImagesClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryImageName string, galleryImages GalleryImagesUpdateRequest, options *GalleryImagesClientBeginUpdateOptions) (*runtime.Poller[GalleryImagesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, galleryImageName, galleryImages, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryImagesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[GalleryImagesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - The operation to update a gallery image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *GalleryImagesClient) update(ctx context.Context, resourceGroupName string, galleryImageName string, galleryImages GalleryImagesUpdateRequest, options *GalleryImagesClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryImageName, galleryImages, 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 *GalleryImagesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryImageName string, galleryImages GalleryImagesUpdateRequest, options *GalleryImagesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + 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 galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, galleryImages); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client_example_test.go new file mode 100644 index 000000000000..0224161e28e0 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client_example_test.go @@ -0,0 +1,368 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armazurestackhci_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/azurestackhci/armazurestackhci/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetGalleryImage.json +func ExampleGalleryImagesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGalleryImagesClient().Get(ctx, "test-rg", "test-gallery-image", 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.GalleryImages = armazurestackhci.GalleryImages{ + // Name: to.Ptr("test-gallery-image"), + // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.GalleryImageProperties{ + // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), + // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), + // Identifier: &armazurestackhci.GalleryImageIdentifier{ + // Offer: to.Ptr("myOfferName"), + // Publisher: to.Ptr("myPublisherName"), + // SKU: to.Ptr("mySkuName"), + // }, + // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // Status: &armazurestackhci.GalleryImageStatus{ + // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ + // DownloadSizeInMB: to.Ptr[int64](9383), + // }, + // ProgressPercentage: to.Ptr[int64](100), + // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ + // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), + // Status: to.Ptr(armazurestackhci.StatusSucceeded), + // }, + // }, + // Version: &armazurestackhci.GalleryImageVersion{ + // Name: to.Ptr("1.0.0"), + // Properties: &armazurestackhci.GalleryImageVersionProperties{ + // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ + // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ + // SizeInMB: to.Ptr[int64](30270), + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutGalleryImage.json +func ExampleGalleryImagesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewGalleryImagesClient().BeginCreateOrUpdate(ctx, "test-rg", "test-gallery-image", armazurestackhci.GalleryImages{ + Location: to.Ptr("West US2"), + ExtendedLocation: &armazurestackhci.ExtendedLocation{ + Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + }, + Properties: &armazurestackhci.GalleryImageProperties{ + ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), + ImagePath: to.Ptr("C:\\test.vhdx"), + OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), + }, + }, 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.GalleryImages = armazurestackhci.GalleryImages{ + // Name: to.Ptr("test-gallery-image"), + // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.GalleryImageProperties{ + // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), + // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), + // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // Status: &armazurestackhci.GalleryImageStatus{ + // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ + // DownloadSizeInMB: to.Ptr[int64](9383), + // }, + // ProgressPercentage: to.Ptr[int64](100), + // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ + // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), + // Status: to.Ptr(armazurestackhci.StatusSucceeded), + // }, + // }, + // Version: &armazurestackhci.GalleryImageVersion{ + // Properties: &armazurestackhci.GalleryImageVersionProperties{ + // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ + // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ + // SizeInMB: to.Ptr[int64](30270), + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteGalleryImage.json +func ExampleGalleryImagesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewGalleryImagesClient().BeginDelete(ctx, "test-rg", "test-gallery-image", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateGalleryImage.json +func ExampleGalleryImagesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewGalleryImagesClient().BeginUpdate(ctx, "test-rg", "test-gallery-image", armazurestackhci.GalleryImagesUpdateRequest{ + Tags: map[string]*string{ + "additionalProperties": to.Ptr("sample"), + }, + }, 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.GalleryImages = armazurestackhci.GalleryImages{ + // Name: to.Ptr("test-gallery-image"), + // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-galimg3325"), + // Location: to.Ptr("West US2"), + // Tags: map[string]*string{ + // "additionalProperties": to.Ptr("sample"), + // }, + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.GalleryImageProperties{ + // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), + // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), + // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // Status: &armazurestackhci.GalleryImageStatus{ + // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ + // DownloadSizeInMB: to.Ptr[int64](9383), + // }, + // ProgressPercentage: to.Ptr[int64](100), + // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ + // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), + // Status: to.Ptr(armazurestackhci.StatusSucceeded), + // }, + // }, + // Version: &armazurestackhci.GalleryImageVersion{ + // Properties: &armazurestackhci.GalleryImageVersionProperties{ + // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ + // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ + // SizeInMB: to.Ptr[int64](30270), + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListGalleryImageByResourceGroup.json +func ExampleGalleryImagesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewGalleryImagesClient().NewListPager("test-rg", 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.GalleryImagesListResult = armazurestackhci.GalleryImagesListResult{ + // Value: []*armazurestackhci.GalleryImages{ + // { + // Name: to.Ptr("test-gallery-image"), + // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.GalleryImageProperties{ + // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), + // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), + // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // Status: &armazurestackhci.GalleryImageStatus{ + // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ + // DownloadSizeInMB: to.Ptr[int64](9383), + // }, + // ProgressPercentage: to.Ptr[int64](100), + // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ + // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), + // Status: to.Ptr(armazurestackhci.StatusSucceeded), + // }, + // }, + // Version: &armazurestackhci.GalleryImageVersion{ + // Properties: &armazurestackhci.GalleryImageVersionProperties{ + // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ + // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ + // SizeInMB: to.Ptr[int64](30270), + // }, + // }, + // }, + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListGalleryImageBySubscription.json +func ExampleGalleryImagesClient_NewListAllPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewGalleryImagesClient().NewListAllPager(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.GalleryImagesListResult = armazurestackhci.GalleryImagesListResult{ + // Value: []*armazurestackhci.GalleryImages{ + // { + // Name: to.Ptr("test-gallery-image"), + // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.GalleryImageProperties{ + // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), + // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), + // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // Status: &armazurestackhci.GalleryImageStatus{ + // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ + // DownloadSizeInMB: to.Ptr[int64](9383), + // }, + // ProgressPercentage: to.Ptr[int64](100), + // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ + // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), + // Status: to.Ptr(armazurestackhci.StatusSucceeded), + // }, + // }, + // Version: &armazurestackhci.GalleryImageVersion{ + // Properties: &armazurestackhci.GalleryImageVersionProperties{ + // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ + // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ + // SizeInMB: to.Ptr[int64](30270), + // }, + // }, + // }, + // }, + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod index aaebf13316f1..f0ecb53eee63 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod @@ -1,21 +1,21 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2 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 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 ) 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/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect + github.com/golang-jwt/jwt/v5 v5.0.0 // indirect + github.com/google/uuid v1.3.1 // 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 + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.15.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect ) diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum index 8ba445a8c4da..014da0d3b4ac 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum @@ -1,31 +1,31 @@ -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.8.0 h1:9kDVnTz3vbfweTqAUmk/a/pH5pWFCHtvRpHYC0G/dcA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs= +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/AzureAD/microsoft-authentication-library-for-go v1.1.1 h1:WpB/QDNLpMw72xHJc34BNNykqSOeEJDAWkhf0u12/Jk= +github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= 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/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= +github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= +github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/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/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/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= 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= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client.go new file mode 100644 index 000000000000..af178d7d39dd --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client.go @@ -0,0 +1,205 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurestackhci + +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" +) + +// GuestAgentClient contains the methods for the GuestAgent group. +// Don't use this type directly, use NewGuestAgentClient() instead. +type GuestAgentClient struct { + internal *arm.Client +} + +// NewGuestAgentClient creates a new instance of GuestAgentClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGuestAgentClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GuestAgentClient, error) { + cl, err := arm.NewClient(moduleName+".GuestAgentClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GuestAgentClient{ + 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-09-01-preview +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - GuestAgentClientBeginCreateOptions contains the optional parameters for the GuestAgentClient.BeginCreate method. +func (client *GuestAgentClient) BeginCreate(ctx context.Context, resourceURI string, options *GuestAgentClientBeginCreateOptions) (*runtime.Poller[GuestAgentClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GuestAgentClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[GuestAgentClientCreateResponse](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-09-01-preview +func (client *GuestAgentClient) create(ctx context.Context, resourceURI string, options *GuestAgentClientBeginCreateOptions) (*http.Response, error) { + var err error + req, err := client.createCreateRequest(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.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *GuestAgentClient) createCreateRequest(ctx context.Context, resourceURI string, options *GuestAgentClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/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-09-01-preview") + 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 +} + +// BeginDelete - Implements GuestAgent DELETE method. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - GuestAgentClientBeginDeleteOptions contains the optional parameters for the GuestAgentClient.BeginDelete method. +func (client *GuestAgentClient) BeginDelete(ctx context.Context, resourceURI string, options *GuestAgentClientBeginDeleteOptions) (*runtime.Poller[GuestAgentClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[GuestAgentClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[GuestAgentClientDeleteResponse](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-09-01-preview +func (client *GuestAgentClient) deleteOperation(ctx context.Context, resourceURI string, options *GuestAgentClientBeginDeleteOptions) (*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 *GuestAgentClient) deleteCreateRequest(ctx context.Context, resourceURI string, options *GuestAgentClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/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-09-01-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 2023-09-01-preview +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - GuestAgentClientGetOptions contains the optional parameters for the GuestAgentClient.Get method. +func (client *GuestAgentClient) Get(ctx context.Context, resourceURI string, options *GuestAgentClientGetOptions) (GuestAgentClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceURI, options) + if err != nil { + return GuestAgentClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GuestAgentClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GuestAgentClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *GuestAgentClient) getCreateRequest(ctx context.Context, resourceURI string, options *GuestAgentClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GuestAgentClient) getHandleResponse(resp *http.Response) (GuestAgentClientGetResponse, error) { + result := GuestAgentClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GuestAgent); err != nil { + return GuestAgentClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client_example_test.go new file mode 100644 index 000000000000..5c261d768d3b --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client_example_test.go @@ -0,0 +1,113 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armazurestackhci_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/azurestackhci/armazurestackhci/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/CreateGuestAgent.json +func ExampleGuestAgentClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewGuestAgentClient().BeginCreate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", &armazurestackhci.GuestAgentClientBeginCreateOptions{Body: &armazurestackhci.GuestAgent{ + Properties: &armazurestackhci.GuestAgentProperties{ + Credentials: &armazurestackhci.GuestCredential{ + Password: to.Ptr(""), + Username: to.Ptr("tempuser"), + }, + ProvisioningAction: to.Ptr(armazurestackhci.ProvisioningActionInstall), + }, + }, + }) + 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 = armazurestackhci.GuestAgent{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/guestAgents"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default"), + // Properties: &armazurestackhci.GuestAgentProperties{ + // ProvisioningAction: to.Ptr(armazurestackhci.ProvisioningActionInstall), + // ProvisioningState: to.Ptr("Succeeded"), + // Status: to.Ptr("connected"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetGuestAgent.json +func ExampleGuestAgentClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGuestAgentClient().Get(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/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.GuestAgent = armazurestackhci.GuestAgent{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/guestAgents"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default"), + // Properties: &armazurestackhci.GuestAgentProperties{ + // ProvisioningAction: to.Ptr(armazurestackhci.ProvisioningActionInstall), + // ProvisioningState: to.Ptr("Succeeded"), + // Status: to.Ptr("connected"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteGuestAgent.json +func ExampleGuestAgentClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewGuestAgentClient().BeginDelete(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/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) + } +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client.go new file mode 100644 index 000000000000..e287c34fbcf4 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurestackhci + +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" +) + +// GuestAgentsClient contains the methods for the GuestAgents group. +// Don't use this type directly, use NewGuestAgentsClient() instead. +type GuestAgentsClient struct { + internal *arm.Client +} + +// NewGuestAgentsClient creates a new instance of GuestAgentsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGuestAgentsClient(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{ + internal: cl, + } + return client, nil +} + +// NewListPager - Returns the list of GuestAgent of the given vm. +// +// Generated from API version 2023-09-01-preview +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - GuestAgentsClientListOptions contains the optional parameters for the GuestAgentsClient.NewListPager method. +func (client *GuestAgentsClient) NewListPager(resourceURI string, options *GuestAgentsClientListOptions) *runtime.Pager[GuestAgentsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[GuestAgentsClientListResponse]{ + More: func(page GuestAgentsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GuestAgentsClientListResponse) (GuestAgentsClientListResponse, 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 GuestAgentsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GuestAgentsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GuestAgentsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *GuestAgentsClient) listCreateRequest(ctx context.Context, resourceURI string, options *GuestAgentsClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *GuestAgentsClient) listHandleResponse(resp *http.Response) (GuestAgentsClientListResponse, error) { + result := GuestAgentsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GuestAgentList); err != nil { + return GuestAgentsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client_example_test.go new file mode 100644 index 000000000000..b7b2541ee7de --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client_example_test.go @@ -0,0 +1,56 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armazurestackhci_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GuestAgent_List.json +func ExampleGuestAgentsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewGuestAgentsClient().NewListPager("subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", 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 = armazurestackhci.GuestAgentList{ + // Value: []*armazurestackhci.GuestAgent{ + // { + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/guestAgents"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default"), + // Properties: &armazurestackhci.GuestAgentProperties{ + // ProvisioningAction: to.Ptr(armazurestackhci.ProvisioningActionInstall), + // ProvisioningState: to.Ptr("Succeeded"), + // Status: to.Ptr("connected"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client.go new file mode 100644 index 000000000000..c0d23c16c1f4 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client.go @@ -0,0 +1,146 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurestackhci + +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" +) + +// HybridIdentityMetadataClient contains the methods for the HybridIdentityMetadata group. +// Don't use this type directly, use NewHybridIdentityMetadataClient() instead. +type HybridIdentityMetadataClient struct { + internal *arm.Client +} + +// NewHybridIdentityMetadataClient creates a new instance of HybridIdentityMetadataClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHybridIdentityMetadataClient(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{ + 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-09-01-preview +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get +// method. +func (client *HybridIdentityMetadataClient) Get(ctx context.Context, resourceURI string, options *HybridIdentityMetadataClientGetOptions) (HybridIdentityMetadataClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceURI, options) + if err != nil { + return HybridIdentityMetadataClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HybridIdentityMetadataClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HybridIdentityMetadataClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *HybridIdentityMetadataClient) getCreateRequest(ctx context.Context, resourceURI string, options *HybridIdentityMetadataClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/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-09-01-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 +} + +// NewListPager - Returns the list of HybridIdentityMetadata of the given vm. +// +// Generated from API version 2023-09-01-preview +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - HybridIdentityMetadataClientListOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListPager +// method. +func (client *HybridIdentityMetadataClient) NewListPager(resourceURI string, options *HybridIdentityMetadataClientListOptions) *runtime.Pager[HybridIdentityMetadataClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[HybridIdentityMetadataClientListResponse]{ + More: func(page HybridIdentityMetadataClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HybridIdentityMetadataClientListResponse) (HybridIdentityMetadataClientListResponse, 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 HybridIdentityMetadataClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HybridIdentityMetadataClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HybridIdentityMetadataClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *HybridIdentityMetadataClient) listCreateRequest(ctx context.Context, resourceURI string, options *HybridIdentityMetadataClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *HybridIdentityMetadataClient) listHandleResponse(resp *http.Response) (HybridIdentityMetadataClientListResponse, error) { + result := HybridIdentityMetadataClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HybridIdentityMetadataList); err != nil { + return HybridIdentityMetadataClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client_example_test.go new file mode 100644 index 000000000000..40bf9c56d21a --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client_example_test.go @@ -0,0 +1,92 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armazurestackhci_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-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 := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewHybridIdentityMetadataClient().Get(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/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.HybridIdentityMetadata = armazurestackhci.HybridIdentityMetadata{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/hybridIdentityMetadata"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default"), + // Properties: &armazurestackhci.HybridIdentityMetadataProperties{ + // Identity: &armazurestackhci.Identity{ + // Type: to.Ptr("SystemAssigned"), + // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), + // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), + // }, + // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/HybridIdentityMetadata_List.json +func ExampleHybridIdentityMetadataClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewHybridIdentityMetadataClient().NewListPager("subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", 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 = armazurestackhci.HybridIdentityMetadataList{ + // Value: []*armazurestackhci.HybridIdentityMetadata{ + // { + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/hybridIdentityMetadata"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default"), + // Properties: &armazurestackhci.HybridIdentityMetadataProperties{ + // Identity: &armazurestackhci.Identity{ + // Type: to.Ptr("SystemAssigned"), + // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), + // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), + // }, + // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client.go new file mode 100644 index 000000000000..9424dedba4b6 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client.go @@ -0,0 +1,449 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurestackhci + +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" +) + +// LogicalNetworksClient contains the methods for the LogicalNetworks group. +// Don't use this type directly, use NewLogicalNetworksClient() instead. +type LogicalNetworksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewLogicalNetworksClient creates a new instance of LogicalNetworksClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewLogicalNetworksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LogicalNetworksClient, error) { + cl, err := arm.NewClient(moduleName+".LogicalNetworksClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LogicalNetworksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a logical network. Please note some properties can be set only +// during logical network creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - logicalNetworkName - Name of the logical network +// - options - LogicalNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the LogicalNetworksClient.BeginCreateOrUpdate +// method. +func (client *LogicalNetworksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, logicalNetworkName string, logicalNetworks LogicalNetworks, options *LogicalNetworksClientBeginCreateOrUpdateOptions) (*runtime.Poller[LogicalNetworksClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, logicalNetworkName, logicalNetworks, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LogicalNetworksClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LogicalNetworksClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - The operation to create or update a logical network. Please note some properties can be set only during +// logical network creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *LogicalNetworksClient) createOrUpdate(ctx context.Context, resourceGroupName string, logicalNetworkName string, logicalNetworks LogicalNetworks, options *LogicalNetworksClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, logicalNetworkName, logicalNetworks, 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 *LogicalNetworksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, logicalNetworkName string, logicalNetworks LogicalNetworks, options *LogicalNetworksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + 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 logicalNetworkName == "" { + return nil, errors.New("parameter logicalNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{logicalNetworkName}", url.PathEscape(logicalNetworkName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, logicalNetworks); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete a logical network. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - logicalNetworkName - Name of the logical network +// - options - LogicalNetworksClientBeginDeleteOptions contains the optional parameters for the LogicalNetworksClient.BeginDelete +// method. +func (client *LogicalNetworksClient) BeginDelete(ctx context.Context, resourceGroupName string, logicalNetworkName string, options *LogicalNetworksClientBeginDeleteOptions) (*runtime.Poller[LogicalNetworksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, logicalNetworkName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LogicalNetworksClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LogicalNetworksClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - The operation to delete a logical network. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *LogicalNetworksClient) deleteOperation(ctx context.Context, resourceGroupName string, logicalNetworkName string, options *LogicalNetworksClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, logicalNetworkName, 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 *LogicalNetworksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, logicalNetworkName string, options *LogicalNetworksClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + 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 logicalNetworkName == "" { + return nil, errors.New("parameter logicalNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{logicalNetworkName}", url.PathEscape(logicalNetworkName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - logicalNetworkName - Name of the logical network +// - options - LogicalNetworksClientGetOptions contains the optional parameters for the LogicalNetworksClient.Get method. +func (client *LogicalNetworksClient) Get(ctx context.Context, resourceGroupName string, logicalNetworkName string, options *LogicalNetworksClientGetOptions) (LogicalNetworksClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, logicalNetworkName, options) + if err != nil { + return LogicalNetworksClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LogicalNetworksClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LogicalNetworksClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *LogicalNetworksClient) getCreateRequest(ctx context.Context, resourceGroupName string, logicalNetworkName string, options *LogicalNetworksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + 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 logicalNetworkName == "" { + return nil, errors.New("parameter logicalNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{logicalNetworkName}", url.PathEscape(logicalNetworkName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LogicalNetworksClient) getHandleResponse(resp *http.Response) (LogicalNetworksClientGetResponse, error) { + result := LogicalNetworksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LogicalNetworks); err != nil { + return LogicalNetworksClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all of the logical networks in the specified resource group. Use the nextLink property in the response +// to get the next page of logical networks. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - LogicalNetworksClientListOptions contains the optional parameters for the LogicalNetworksClient.NewListPager +// method. +func (client *LogicalNetworksClient) NewListPager(resourceGroupName string, options *LogicalNetworksClientListOptions) *runtime.Pager[LogicalNetworksClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[LogicalNetworksClientListResponse]{ + More: func(page LogicalNetworksClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LogicalNetworksClientListResponse) (LogicalNetworksClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LogicalNetworksClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LogicalNetworksClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LogicalNetworksClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *LogicalNetworksClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *LogicalNetworksClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks" + 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", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LogicalNetworksClient) listHandleResponse(resp *http.Response) (LogicalNetworksClientListResponse, error) { + result := LogicalNetworksClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LogicalNetworksListResult); err != nil { + return LogicalNetworksClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Lists all of the logical networks in the specified subscription. Use the nextLink property in the response +// to get the next page of logical networks. +// +// Generated from API version 2023-09-01-preview +// - options - LogicalNetworksClientListAllOptions contains the optional parameters for the LogicalNetworksClient.NewListAllPager +// method. +func (client *LogicalNetworksClient) NewListAllPager(options *LogicalNetworksClientListAllOptions) *runtime.Pager[LogicalNetworksClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[LogicalNetworksClientListAllResponse]{ + More: func(page LogicalNetworksClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LogicalNetworksClientListAllResponse) (LogicalNetworksClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LogicalNetworksClientListAllResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LogicalNetworksClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LogicalNetworksClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *LogicalNetworksClient) listAllCreateRequest(ctx context.Context, options *LogicalNetworksClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/logicalNetworks" + 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", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *LogicalNetworksClient) listAllHandleResponse(resp *http.Response) (LogicalNetworksClientListAllResponse, error) { + result := LogicalNetworksClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LogicalNetworksListResult); err != nil { + return LogicalNetworksClientListAllResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update a logical network. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - logicalNetworkName - Name of the logical network +// - options - LogicalNetworksClientBeginUpdateOptions contains the optional parameters for the LogicalNetworksClient.BeginUpdate +// method. +func (client *LogicalNetworksClient) BeginUpdate(ctx context.Context, resourceGroupName string, logicalNetworkName string, logicalNetworks LogicalNetworksUpdateRequest, options *LogicalNetworksClientBeginUpdateOptions) (*runtime.Poller[LogicalNetworksClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, logicalNetworkName, logicalNetworks, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LogicalNetworksClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LogicalNetworksClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - The operation to update a logical network. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *LogicalNetworksClient) update(ctx context.Context, resourceGroupName string, logicalNetworkName string, logicalNetworks LogicalNetworksUpdateRequest, options *LogicalNetworksClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, logicalNetworkName, logicalNetworks, 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 *LogicalNetworksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, logicalNetworkName string, logicalNetworks LogicalNetworksUpdateRequest, options *LogicalNetworksClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + 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 logicalNetworkName == "" { + return nil, errors.New("parameter logicalNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{logicalNetworkName}", url.PathEscape(logicalNetworkName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, logicalNetworks); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client_example_test.go new file mode 100644 index 000000000000..620fed06d072 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client_example_test.go @@ -0,0 +1,242 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armazurestackhci_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/azurestackhci/armazurestackhci/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetLogicalNetwork.json +func ExampleLogicalNetworksClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLogicalNetworksClient().Get(ctx, "test-rg", "test-lnet", 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.LogicalNetworks = armazurestackhci.LogicalNetworks{ + // Name: to.Ptr("test-lnet"), + // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.LogicalNetworkProperties{ + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutLogicalNetwork.json +func ExampleLogicalNetworksClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLogicalNetworksClient().BeginCreateOrUpdate(ctx, "test-rg", "test-lnet", armazurestackhci.LogicalNetworks{ + Location: to.Ptr("West US2"), + ExtendedLocation: &armazurestackhci.ExtendedLocation{ + Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + }, + }, 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.LogicalNetworks = armazurestackhci.LogicalNetworks{ + // Name: to.Ptr("test-lnet"), + // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.LogicalNetworkProperties{ + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteLogicalNetwork.json +func ExampleLogicalNetworksClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLogicalNetworksClient().BeginDelete(ctx, "test-rg", "test-lnet", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateLogicalNetwork.json +func ExampleLogicalNetworksClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLogicalNetworksClient().BeginUpdate(ctx, "test-rg", "test-lnet", armazurestackhci.LogicalNetworksUpdateRequest{ + Tags: map[string]*string{ + "additionalProperties": to.Ptr("sample"), + }, + }, 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.LogicalNetworks = armazurestackhci.LogicalNetworks{ + // Name: to.Ptr("test-lnet"), + // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"), + // Location: to.Ptr("West US2"), + // Tags: map[string]*string{ + // "additionalProperties": to.Ptr("sample"), + // }, + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.LogicalNetworkProperties{ + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListLogicalNetworkByResourceGroup.json +func ExampleLogicalNetworksClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLogicalNetworksClient().NewListPager("test-rg", 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.LogicalNetworksListResult = armazurestackhci.LogicalNetworksListResult{ + // Value: []*armazurestackhci.LogicalNetworks{ + // { + // Name: to.Ptr("test-lnet"), + // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-lnet"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.LogicalNetworkProperties{ + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListLogicalNetworkBySubscription.json +func ExampleLogicalNetworksClient_NewListAllPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLogicalNetworksClient().NewListAllPager(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.LogicalNetworksListResult = armazurestackhci.LogicalNetworksListResult{ + // Value: []*armazurestackhci.LogicalNetworks{ + // { + // Name: to.Ptr("test-lnet"), + // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.LogicalNetworkProperties{ + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client.go new file mode 100644 index 000000000000..62ff42066dd7 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client.go @@ -0,0 +1,450 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurestackhci + +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" +) + +// MarketplaceGalleryImagesClient contains the methods for the MarketplaceGalleryImages group. +// Don't use this type directly, use NewMarketplaceGalleryImagesClient() instead. +type MarketplaceGalleryImagesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMarketplaceGalleryImagesClient creates a new instance of MarketplaceGalleryImagesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMarketplaceGalleryImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MarketplaceGalleryImagesClient, error) { + cl, err := arm.NewClient(moduleName+".MarketplaceGalleryImagesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MarketplaceGalleryImagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a marketplace gallery image. Please note some properties can be +// set only during marketplace gallery image creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - marketplaceGalleryImageName - Name of the marketplace gallery image +// - options - MarketplaceGalleryImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the MarketplaceGalleryImagesClient.BeginCreateOrUpdate +// method. +func (client *MarketplaceGalleryImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, marketplaceGalleryImages MarketplaceGalleryImages, options *MarketplaceGalleryImagesClientBeginCreateOrUpdateOptions) (*runtime.Poller[MarketplaceGalleryImagesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, marketplaceGalleryImageName, marketplaceGalleryImages, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MarketplaceGalleryImagesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[MarketplaceGalleryImagesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - The operation to create or update a marketplace gallery image. Please note some properties can be set +// only during marketplace gallery image creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *MarketplaceGalleryImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, marketplaceGalleryImages MarketplaceGalleryImages, options *MarketplaceGalleryImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, marketplaceGalleryImageName, marketplaceGalleryImages, 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 *MarketplaceGalleryImagesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, marketplaceGalleryImages MarketplaceGalleryImages, options *MarketplaceGalleryImagesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + 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 marketplaceGalleryImageName == "" { + return nil, errors.New("parameter marketplaceGalleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{marketplaceGalleryImageName}", url.PathEscape(marketplaceGalleryImageName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, marketplaceGalleryImages); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete a marketplace gallery image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - marketplaceGalleryImageName - Name of the marketplace gallery image +// - options - MarketplaceGalleryImagesClientBeginDeleteOptions contains the optional parameters for the MarketplaceGalleryImagesClient.BeginDelete +// method. +func (client *MarketplaceGalleryImagesClient) BeginDelete(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, options *MarketplaceGalleryImagesClientBeginDeleteOptions) (*runtime.Poller[MarketplaceGalleryImagesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, marketplaceGalleryImageName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MarketplaceGalleryImagesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[MarketplaceGalleryImagesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - The operation to delete a marketplace gallery image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *MarketplaceGalleryImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, options *MarketplaceGalleryImagesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, marketplaceGalleryImageName, 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 *MarketplaceGalleryImagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, options *MarketplaceGalleryImagesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + 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 marketplaceGalleryImageName == "" { + return nil, errors.New("parameter marketplaceGalleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{marketplaceGalleryImageName}", url.PathEscape(marketplaceGalleryImageName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a marketplace gallery image +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - marketplaceGalleryImageName - Name of the marketplace gallery image +// - options - MarketplaceGalleryImagesClientGetOptions contains the optional parameters for the MarketplaceGalleryImagesClient.Get +// method. +func (client *MarketplaceGalleryImagesClient) Get(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, options *MarketplaceGalleryImagesClientGetOptions) (MarketplaceGalleryImagesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, marketplaceGalleryImageName, options) + if err != nil { + return MarketplaceGalleryImagesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MarketplaceGalleryImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MarketplaceGalleryImagesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *MarketplaceGalleryImagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, options *MarketplaceGalleryImagesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + 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 marketplaceGalleryImageName == "" { + return nil, errors.New("parameter marketplaceGalleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{marketplaceGalleryImageName}", url.PathEscape(marketplaceGalleryImageName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MarketplaceGalleryImagesClient) getHandleResponse(resp *http.Response) (MarketplaceGalleryImagesClientGetResponse, error) { + result := MarketplaceGalleryImagesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MarketplaceGalleryImages); err != nil { + return MarketplaceGalleryImagesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in +// the response to get the next page of marketplace gallery images. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - MarketplaceGalleryImagesClientListOptions contains the optional parameters for the MarketplaceGalleryImagesClient.NewListPager +// method. +func (client *MarketplaceGalleryImagesClient) NewListPager(resourceGroupName string, options *MarketplaceGalleryImagesClientListOptions) *runtime.Pager[MarketplaceGalleryImagesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[MarketplaceGalleryImagesClientListResponse]{ + More: func(page MarketplaceGalleryImagesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MarketplaceGalleryImagesClientListResponse) (MarketplaceGalleryImagesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return MarketplaceGalleryImagesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MarketplaceGalleryImagesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MarketplaceGalleryImagesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *MarketplaceGalleryImagesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *MarketplaceGalleryImagesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages" + 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", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *MarketplaceGalleryImagesClient) listHandleResponse(resp *http.Response) (MarketplaceGalleryImagesClientListResponse, error) { + result := MarketplaceGalleryImagesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MarketplaceGalleryImagesListResult); err != nil { + return MarketplaceGalleryImagesClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property +// in the response to get the next page of marketplace gallery images. +// +// Generated from API version 2023-09-01-preview +// - options - MarketplaceGalleryImagesClientListAllOptions contains the optional parameters for the MarketplaceGalleryImagesClient.NewListAllPager +// method. +func (client *MarketplaceGalleryImagesClient) NewListAllPager(options *MarketplaceGalleryImagesClientListAllOptions) *runtime.Pager[MarketplaceGalleryImagesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[MarketplaceGalleryImagesClientListAllResponse]{ + More: func(page MarketplaceGalleryImagesClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MarketplaceGalleryImagesClientListAllResponse) (MarketplaceGalleryImagesClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return MarketplaceGalleryImagesClientListAllResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MarketplaceGalleryImagesClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MarketplaceGalleryImagesClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *MarketplaceGalleryImagesClient) listAllCreateRequest(ctx context.Context, options *MarketplaceGalleryImagesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages" + 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", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *MarketplaceGalleryImagesClient) listAllHandleResponse(resp *http.Response) (MarketplaceGalleryImagesClientListAllResponse, error) { + result := MarketplaceGalleryImagesClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MarketplaceGalleryImagesListResult); err != nil { + return MarketplaceGalleryImagesClientListAllResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update a marketplace gallery image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - marketplaceGalleryImageName - Name of the marketplace gallery image +// - options - MarketplaceGalleryImagesClientBeginUpdateOptions contains the optional parameters for the MarketplaceGalleryImagesClient.BeginUpdate +// method. +func (client *MarketplaceGalleryImagesClient) BeginUpdate(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, marketplaceGalleryImages MarketplaceGalleryImagesUpdateRequest, options *MarketplaceGalleryImagesClientBeginUpdateOptions) (*runtime.Poller[MarketplaceGalleryImagesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, marketplaceGalleryImageName, marketplaceGalleryImages, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MarketplaceGalleryImagesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[MarketplaceGalleryImagesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - The operation to update a marketplace gallery image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *MarketplaceGalleryImagesClient) update(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, marketplaceGalleryImages MarketplaceGalleryImagesUpdateRequest, options *MarketplaceGalleryImagesClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, marketplaceGalleryImageName, marketplaceGalleryImages, 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 *MarketplaceGalleryImagesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, marketplaceGalleryImages MarketplaceGalleryImagesUpdateRequest, options *MarketplaceGalleryImagesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + 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 marketplaceGalleryImageName == "" { + return nil, errors.New("parameter marketplaceGalleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{marketplaceGalleryImageName}", url.PathEscape(marketplaceGalleryImageName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, marketplaceGalleryImages); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client_example_test.go new file mode 100644 index 000000000000..0c7011e1fa15 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client_example_test.go @@ -0,0 +1,401 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armazurestackhci_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/azurestackhci/armazurestackhci/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetMarketplaceGalleryImage.json +func ExampleMarketplaceGalleryImagesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMarketplaceGalleryImagesClient().Get(ctx, "test-rg", "test-marketplace-gallery-image", 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.MarketplaceGalleryImages = armazurestackhci.MarketplaceGalleryImages{ + // Name: to.Ptr("test-marketplace-gallery-image"), + // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ + // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), + // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), + // Identifier: &armazurestackhci.GalleryImageIdentifier{ + // Offer: to.Ptr("myOfferName"), + // Publisher: to.Ptr("myPublisherName"), + // SKU: to.Ptr("mySkuName"), + // }, + // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ + // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ + // DownloadSizeInMB: to.Ptr[int64](9383), + // }, + // ProgressPercentage: to.Ptr[int64](100), + // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ + // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), + // Status: to.Ptr(armazurestackhci.StatusSucceeded), + // }, + // }, + // Version: &armazurestackhci.GalleryImageVersion{ + // Name: to.Ptr("1.0.0"), + // Properties: &armazurestackhci.GalleryImageVersionProperties{ + // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ + // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ + // SizeInMB: to.Ptr[int64](30270), + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutMarketplaceGalleryImage.json +func ExampleMarketplaceGalleryImagesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMarketplaceGalleryImagesClient().BeginCreateOrUpdate(ctx, "test-rg", "test-marketplace-gallery-image", armazurestackhci.MarketplaceGalleryImages{ + Location: to.Ptr("West US2"), + ExtendedLocation: &armazurestackhci.ExtendedLocation{ + Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + }, + Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ + CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), + ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), + HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), + Identifier: &armazurestackhci.GalleryImageIdentifier{ + Offer: to.Ptr("myOfferName"), + Publisher: to.Ptr("myPublisherName"), + SKU: to.Ptr("mySkuName"), + }, + OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), + Version: &armazurestackhci.GalleryImageVersion{ + Name: to.Ptr("1.0.0"), + }, + }, + }, 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.MarketplaceGalleryImages = armazurestackhci.MarketplaceGalleryImages{ + // Name: to.Ptr("test-marketplace-gallery-image"), + // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ + // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), + // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), + // Identifier: &armazurestackhci.GalleryImageIdentifier{ + // Offer: to.Ptr("myOfferName"), + // Publisher: to.Ptr("myPublisherName"), + // SKU: to.Ptr("mySkuName"), + // }, + // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ + // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ + // DownloadSizeInMB: to.Ptr[int64](9383), + // }, + // ProgressPercentage: to.Ptr[int64](0), + // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ + // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), + // Status: to.Ptr(armazurestackhci.StatusInProgress), + // }, + // }, + // Version: &armazurestackhci.GalleryImageVersion{ + // Name: to.Ptr("1.0.0"), + // Properties: &armazurestackhci.GalleryImageVersionProperties{ + // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ + // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ + // SizeInMB: to.Ptr[int64](30270), + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteMarketplaceGalleryImage.json +func ExampleMarketplaceGalleryImagesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMarketplaceGalleryImagesClient().BeginDelete(ctx, "test-rg", "test-marketplace-gallery-image", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateMarketplaceGalleryImage.json +func ExampleMarketplaceGalleryImagesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMarketplaceGalleryImagesClient().BeginUpdate(ctx, "test-rg", "test-marketplce-gallery-image", armazurestackhci.MarketplaceGalleryImagesUpdateRequest{ + Tags: map[string]*string{ + "additionalProperties": to.Ptr("sample"), + }, + }, 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.MarketplaceGalleryImages = armazurestackhci.MarketplaceGalleryImages{ + // Name: to.Ptr("test-marketplace-gallery-image"), + // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), + // Location: to.Ptr("West US2"), + // Tags: map[string]*string{ + // "additionalProperties": to.Ptr("sample"), + // }, + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ + // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), + // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), + // Identifier: &armazurestackhci.GalleryImageIdentifier{ + // Offer: to.Ptr("myOfferName"), + // Publisher: to.Ptr("myPublisherName"), + // SKU: to.Ptr("mySkuName"), + // }, + // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ + // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ + // DownloadSizeInMB: to.Ptr[int64](9383), + // }, + // ProgressPercentage: to.Ptr[int64](0), + // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ + // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), + // Status: to.Ptr(armazurestackhci.StatusInProgress), + // }, + // }, + // Version: &armazurestackhci.GalleryImageVersion{ + // Name: to.Ptr("1.0.0"), + // Properties: &armazurestackhci.GalleryImageVersionProperties{ + // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ + // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ + // SizeInMB: to.Ptr[int64](30270), + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListMarketplaceGalleryImageByResourceGroup.json +func ExampleMarketplaceGalleryImagesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewMarketplaceGalleryImagesClient().NewListPager("test-rg", 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.MarketplaceGalleryImagesListResult = armazurestackhci.MarketplaceGalleryImagesListResult{ + // Value: []*armazurestackhci.MarketplaceGalleryImages{ + // { + // Name: to.Ptr("test-marketplace-gallery-image"), + // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ + // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), + // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), + // Identifier: &armazurestackhci.GalleryImageIdentifier{ + // Offer: to.Ptr("myOfferName"), + // Publisher: to.Ptr("myPublisherName"), + // SKU: to.Ptr("mySkuName"), + // }, + // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ + // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ + // DownloadSizeInMB: to.Ptr[int64](9383), + // }, + // ProgressPercentage: to.Ptr[int64](100), + // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ + // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), + // Status: to.Ptr(armazurestackhci.StatusSucceeded), + // }, + // }, + // Version: &armazurestackhci.GalleryImageVersion{ + // Name: to.Ptr("1.0.0"), + // Properties: &armazurestackhci.GalleryImageVersionProperties{ + // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ + // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ + // SizeInMB: to.Ptr[int64](30270), + // }, + // }, + // }, + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListMarketplaceGalleryImageBySubscription.json +func ExampleMarketplaceGalleryImagesClient_NewListAllPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewMarketplaceGalleryImagesClient().NewListAllPager(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.MarketplaceGalleryImagesListResult = armazurestackhci.MarketplaceGalleryImagesListResult{ + // Value: []*armazurestackhci.MarketplaceGalleryImages{ + // { + // Name: to.Ptr("test-marketplace-gallery-image"), + // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ + // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), + // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), + // Identifier: &armazurestackhci.GalleryImageIdentifier{ + // Offer: to.Ptr("myOfferName"), + // Publisher: to.Ptr("myPublisherName"), + // SKU: to.Ptr("mySkuName"), + // }, + // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ + // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ + // DownloadSizeInMB: to.Ptr[int64](9383), + // }, + // ProgressPercentage: to.Ptr[int64](100), + // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ + // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), + // Status: to.Ptr(armazurestackhci.StatusSucceeded), + // }, + // }, + // Version: &armazurestackhci.GalleryImageVersion{ + // Name: to.Ptr("1.0.0"), + // Properties: &armazurestackhci.GalleryImageVersionProperties{ + // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ + // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ + // SizeInMB: to.Ptr[int64](30270), + // }, + // }, + // }, + // }, + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go index 722e8d71fe48..054c38749a89 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go @@ -3,151 +3,152 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armazurestackhci import "time" -// ArcConnectivityProperties - Connectivity related configuration required by arc server. -type ArcConnectivityProperties struct { - // True indicates ARC connectivity is enabled - Enabled *bool -} +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any -// ArcIdentityResponse - ArcIdentity details. -type ArcIdentityResponse struct { - // READ-ONLY; ArcIdentity properties. - Properties *ArcIdentityResponseProperties + // READ-ONLY; The additional info type. + Type *string } -type ArcIdentityResponseProperties struct { - ArcApplicationClientID *string - ArcApplicationObjectID *string - ArcApplicationTenantID *string - ArcServicePrincipalObjectID *string -} +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo -// ArcSetting details. -type ArcSetting struct { - // ArcSetting properties. - Properties *ArcSettingProperties + // READ-ONLY; The error code. + Code *string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string + // READ-ONLY; The error details. + Details []*ErrorDetail - // READ-ONLY; The name of the resource - Name *string + // READ-ONLY; The error message. + Message *string - // READ-ONLY; System data of ArcSetting resource - SystemData *SystemData + // READ-ONLY; The error target. + Target *string +} - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string +// ExtendedLocation - The complex type of the extended location. +type ExtendedLocation struct { + // The name of the extended location. + Name *string + + // The type of the extended location. + Type *ExtendedLocationTypes } -// ArcSettingList - List of ArcSetting proxy resources for the HCI cluster. -type ArcSettingList struct { - // READ-ONLY; Link to the next set of results. - NextLink *string +// GalleryImageIdentifier - This is the gallery image definition identifier. +type GalleryImageIdentifier struct { + // REQUIRED; The name of the gallery image definition offer. + Offer *string + + // REQUIRED; The name of the gallery image definition publisher. + Publisher *string - // READ-ONLY; List of ArcSetting proxy resources. - Value []*ArcSetting + // REQUIRED; The name of the gallery image definition SKU. + SKU *string } -// ArcSettingProperties - ArcSetting properties. -type ArcSettingProperties struct { - // App id of arc AAD identity. - ArcApplicationClientID *string +// GalleryImageProperties - Properties under the gallery image resource +type GalleryImageProperties struct { + // REQUIRED; Operating system type that the gallery image uses [Windows, Linux] + OSType *OperatingSystemTypes - // Object id of arc AAD identity. - ArcApplicationObjectID *string + // Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + CloudInitDataSource *CloudInitDataSource - // Tenant id of arc AAD identity. - ArcApplicationTenantID *string + // Storage ContainerID of the storage container to be used for gallery image + ContainerID *string - // The resource group that hosts the Arc agents, ie. Hybrid Compute Machine resources. - ArcInstanceResourceGroup *string + // The hypervisor generation of the Virtual Machine [V1, V2] + HyperVGeneration *HyperVGeneration - // Object id of arc AAD service principal. - ArcServicePrincipalObjectID *string + // This is the gallery image definition identifier. + Identifier *GalleryImageIdentifier - // contains connectivity related configuration for ARC resources - ConnectivityProperties any + // location of the image the gallery image should be created from + ImagePath *string - // READ-ONLY; Aggregate state of Arc agent across the nodes in this HCI cluster. - AggregateState *ArcSettingAggregateState + // Specifies information about the gallery image version that you want to create or update. + Version *GalleryImageVersion - // READ-ONLY; State of Arc agent in each of the nodes. - PerNodeDetails []*PerNodeState + // READ-ONLY; Provisioning state of the gallery image. + ProvisioningState *ProvisioningStateEnum - // READ-ONLY; Provisioning state of the ArcSetting proxy resource. - ProvisioningState *ProvisioningState + // READ-ONLY; The observed state of gallery images + Status *GalleryImageStatus } -// ArcSettingsClientBeginCreateIdentityOptions contains the optional parameters for the ArcSettingsClient.BeginCreateIdentity -// method. -type ArcSettingsClientBeginCreateIdentityOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} +// GalleryImageStatus - The observed state of gallery images +type GalleryImageStatus struct { + // The download status of the gallery image + DownloadStatus *GalleryImageStatusDownloadStatus -// ArcSettingsClientBeginDeleteOptions contains the optional parameters for the ArcSettingsClient.BeginDelete method. -type ArcSettingsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // GalleryImage provisioning error code + ErrorCode *string -// ArcSettingsClientCreateOptions contains the optional parameters for the ArcSettingsClient.Create method. -type ArcSettingsClientCreateOptions struct { - // placeholder for future optional parameters -} + // Descriptive error message + ErrorMessage *string -// ArcSettingsClientGeneratePasswordOptions contains the optional parameters for the ArcSettingsClient.GeneratePassword method. -type ArcSettingsClientGeneratePasswordOptions struct { - // placeholder for future optional parameters + // The progress of the operation in percentage + ProgressPercentage *int64 + ProvisioningStatus *GalleryImageStatusProvisioningStatus } -// ArcSettingsClientGetOptions contains the optional parameters for the ArcSettingsClient.Get method. -type ArcSettingsClientGetOptions struct { - // placeholder for future optional parameters +// GalleryImageStatusDownloadStatus - The download status of the gallery image +type GalleryImageStatusDownloadStatus struct { + // The downloaded sized of the image in MB + DownloadSizeInMB *int64 } -// ArcSettingsClientListByClusterOptions contains the optional parameters for the ArcSettingsClient.NewListByClusterPager -// method. -type ArcSettingsClientListByClusterOptions struct { - // placeholder for future optional parameters -} +type GalleryImageStatusProvisioningStatus struct { + // The ID of the operation performed on the gallery image + OperationID *string -// ArcSettingsClientUpdateOptions contains the optional parameters for the ArcSettingsClient.Update method. -type ArcSettingsClientUpdateOptions struct { - // placeholder for future optional parameters + // The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + Status *Status } -// ArcSettingsPatch - ArcSetting details to update. -type ArcSettingsPatch struct { - // ArcSettings properties. - Properties *ArcSettingsPatchProperties +// GalleryImageVersion - Specifies information about the gallery image version that you want to create or update. +type GalleryImageVersion struct { + // This is the version of the gallery image. + Name *string - // Resource tags. - Tags map[string]*string + // Describes the properties of a gallery image version. + Properties *GalleryImageVersionProperties } -// ArcSettingsPatchProperties - ArcSettings properties. -type ArcSettingsPatchProperties struct { - // contains connectivity related configuration for ARC resources - ConnectivityProperties any +// GalleryImageVersionProperties - Describes the properties of a gallery image version. +type GalleryImageVersionProperties struct { + // REQUIRED; This is the storage profile of a Gallery Image Version. + StorageProfile *GalleryImageVersionStorageProfile } -// Cluster details. -type Cluster struct { +// GalleryImageVersionStorageProfile - This is the storage profile of a Gallery Image Version. +type GalleryImageVersionStorageProfile struct { + // This is the OS disk image. + OSDiskImage *GalleryOSDiskImage +} + +// GalleryImages - The gallery images resource definition. +type GalleryImages struct { // REQUIRED; The geo-location where the resource lives Location *string - // Cluster properties. - Properties *ClusterProperties + // The extendedLocation of the resource. + ExtendedLocation *ExtendedLocation + + // Properties under the gallery image resource + Properties *GalleryImageProperties // Resource tags. Tags map[string]*string @@ -158,260 +159,409 @@ type Cluster struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; System data of Cluster resource + // 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 } -// ClusterDesiredProperties - Desired properties of the cluster. -type ClusterDesiredProperties struct { - // Desired level of diagnostic data emitted by the cluster. - DiagnosticLevel *DiagnosticLevel +// GalleryImagesListResult - List of gallery images. +type GalleryImagesListResult struct { + Value []*GalleryImages - // Desired state of Windows Server Subscription. - WindowsServerSubscription *WindowsServerSubscription + // READ-ONLY; Link to the next set of results. + NextLink *string } -// ClusterIdentityResponse - Cluster Identity details. -type ClusterIdentityResponse struct { - // READ-ONLY; Cluster identity properties. - Properties *ClusterIdentityResponseProperties +// GalleryImagesUpdateRequest - The gallery images resource patch definition. +type GalleryImagesUpdateRequest struct { + // Resource tags + Tags map[string]*string } -type ClusterIdentityResponseProperties struct { - AADApplicationObjectID *string - AADClientID *string - AADServicePrincipalObjectID *string - AADTenantID *string +// GalleryOSDiskImage - This is the OS disk image. +type GalleryOSDiskImage struct { + // READ-ONLY; This property indicates the size of the VHD to be created. + SizeInMB *int64 } -// ClusterList - List of clusters. -type ClusterList struct { - // List of clusters. - Value []*Cluster +// GuestAgent - Defines the GuestAgent. +type GuestAgent struct { + // REQUIRED; Resource properties. + Properties *GuestAgentProperties - // READ-ONLY; Link to the next set of results. + // 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; 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 +} + +// GuestAgentInstallStatus - Defines the status of a guest agent installation. +type GuestAgentInstallStatus 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 installation status of the hybrid machine agent installation. + Status *StatusTypes + + // READ-ONLY; Specifies the VM's unique SMBIOS ID. + VMUUID *string +} + +// GuestAgentList - List of GuestAgent. +type GuestAgentList struct { + // REQUIRED; Array of GuestAgent + Value []*GuestAgent + + // Url to follow for getting next page of GuestAgent. NextLink *string } -// ClusterNode - Cluster node details. -type ClusterNode struct { - // READ-ONLY; Number of physical cores on the cluster node. - CoreCount *float32 +// GuestAgentProperties - Defines the resource properties. +type GuestAgentProperties struct { + // Username / Password Credentials to provision guest agent. + Credentials *GuestCredential - // READ-ONLY; Id of the node in the cluster. - ID *float32 + // The guest agent provisioning action. + ProvisioningAction *ProvisioningAction - // READ-ONLY; Manufacturer of the cluster node hardware. - Manufacturer *string + // READ-ONLY; The provisioning state. + ProvisioningState *string - // READ-ONLY; Total available memory on the cluster node (in GiB). - MemoryInGiB *float32 + // READ-ONLY; The guest agent status. + Status *string +} - // READ-ONLY; Model name of the cluster node hardware. - Model *string +// GuestCredential - Username / Password Credentials to connect to guest. +type GuestCredential struct { + // The password to connect with the guest. + Password *string - // READ-ONLY; Name of the cluster node. - Name *string + // The username to connect with the guest. + Username *string +} - // READ-ONLY; Operating system running on the cluster node. - OSName *string +// HTTPProxyConfiguration - HTTP Proxy configuration for the VM. +type HTTPProxyConfiguration struct { + // The HTTP proxy server endpoint to use. + HTTPProxy *string - // READ-ONLY; Version of the operating system running on the cluster node. - OSVersion *string + // The HTTPS proxy server endpoint to use. + HTTPSProxy *string - // READ-ONLY; Immutable id of the cluster node. - SerialNumber *string + // The endpoints that should not go through proxy. + NoProxy []*string - // READ-ONLY; State of Windows Server Subscription. - WindowsServerSubscription *WindowsServerSubscription + // Alternative CA cert to use for connecting to proxy servers. + TrustedCa *string } -// ClusterPatch - Cluster details to update. -type ClusterPatch struct { - // Cluster properties. - Properties *ClusterPatchProperties +// HardwareProfileUpdate - HardwareProfile - Specifies the hardware settings for the virtual machine instance. +type HardwareProfileUpdate struct { + // RAM in MB for the virtual machine instance + MemoryMB *int64 - // Resource tags. - Tags map[string]*string + // number of processors for the virtual machine instance + Processors *int32 + VMSize *VMSizeEnum } -// ClusterPatchProperties - Cluster properties. -type ClusterPatchProperties struct { - // App id of cluster AAD identity. - AADClientID *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 - // Tenant id of cluster AAD identity. - AADTenantID *string + // READ-ONLY; The name of the resource + Name *string - // Endpoint configured for management from the Azure portal - CloudManagementEndpoint *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Desired properties of the cluster. - DesiredProperties *ClusterDesiredProperties + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// ClusterProperties - Cluster properties. -type ClusterProperties struct { - // Object id of cluster AAD identity. - AADApplicationObjectID *string +// HybridIdentityMetadataList - List of HybridIdentityMetadata. +type HybridIdentityMetadataList struct { + // REQUIRED; Array of HybridIdentityMetadata + Value []*HybridIdentityMetadata - // App id of cluster AAD identity. - AADClientID *string + // Url to follow for getting next page of HybridIdentityMetadata. + NextLink *string +} - // Id of cluster identity service principal. - AADServicePrincipalObjectID *string +// HybridIdentityMetadataProperties - Defines the resource properties. +type HybridIdentityMetadataProperties struct { + // The Public Key. + PublicKey *string - // Tenant id of cluster AAD identity. - AADTenantID *string + // The unique identifier for the resource. + ResourceUID *string - // Endpoint configured for management from the Azure portal. - CloudManagementEndpoint *string + // READ-ONLY; Identity for the resource. + Identity *Identity - // Desired properties of the cluster. - DesiredProperties *ClusterDesiredProperties + // READ-ONLY; The provisioning state. + ProvisioningState *string +} - // READ-ONLY; Type of billing applied to the resource. - BillingModel *string +// IPConfiguration - InterfaceIPConfiguration iPConfiguration in a network interface. +type IPConfiguration struct { + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string - // READ-ONLY; Unique, immutable resource id. - CloudID *string + // InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + Properties *IPConfigurationProperties +} - // READ-ONLY; Most recent billing meter timestamp. - LastBillingTimestamp *time.Time +// IPConfigurationProperties - InterfaceIPConfigurationPropertiesFormat properties of IP configuration. +type IPConfigurationProperties struct { + // PrivateIPAddress - Private IP address of the IP configuration. + PrivateIPAddress *string - // READ-ONLY; Most recent cluster sync timestamp. - LastSyncTimestamp *time.Time + // Subnet - Name of Subnet bound to the IP configuration. + Subnet *IPConfigurationPropertiesSubnet - // READ-ONLY; Provisioning state. - ProvisioningState *ProvisioningState + // READ-ONLY; Gateway for network interface + Gateway *string - // READ-ONLY; First cluster sync timestamp. - RegistrationTimestamp *time.Time + // READ-ONLY; prefixLength for network interface + PrefixLength *string +} - // READ-ONLY; Properties reported by cluster agent. - ReportedProperties *ClusterReportedProperties +// IPConfigurationPropertiesSubnet - Subnet - Name of Subnet bound to the IP configuration. +type IPConfigurationPropertiesSubnet struct { + // ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/… + ID *string +} - // READ-ONLY; Region specific DataPath Endpoint of the cluster. - ServiceEndpoint *string +type IPPool struct { + // End of the IP address pool + End *string - // READ-ONLY; Status of the cluster agent. - Status *Status + // Type of the IP Pool [vm, vippool] + IPPoolType *IPPoolTypeEnum + Info *IPPoolInfo + + // Name of the IP-Pool + Name *string + + // Start of the IP address pool + Start *string +} + +type IPPoolInfo struct { + // READ-ONLY; Number of IP addresses available in the IP Pool + Available *string - // READ-ONLY; Number of days remaining in the trial period. - TrialDaysRemaining *float32 + // READ-ONLY; Number of IP addresses allocated from the IP Pool + Used *string } -// ClusterReportedProperties - Properties reported by cluster agent. -type ClusterReportedProperties struct { - // Level of diagnostic data emitted by the cluster. - DiagnosticLevel *DiagnosticLevel +// Identity for the resource. +type Identity struct { + // The identity type. + Type *string + + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string - // READ-ONLY; Unique id generated by the on-prem cluster. - ClusterID *string + // READ-ONLY; The tenant ID of resource. + TenantID *string +} - // READ-ONLY; Name of the on-prem cluster connected to this resource. - ClusterName *string +// InstanceViewStatus - Instance view status. +type InstanceViewStatus struct { + // The status code. + Code *string - // READ-ONLY; Version of the cluster software. - ClusterVersion *string + // The short localizable label for the status. + DisplayStatus *string - // READ-ONLY; IMDS attestation status of the cluster. - ImdsAttestation *ImdsAttestation + // The level code. + Level *StatusLevelTypes - // READ-ONLY; Last time the cluster reported the data. - LastUpdated *time.Time + // The detailed status message, including for alerts and error messages. + Message *string - // READ-ONLY; List of nodes reported by the cluster. - Nodes []*ClusterNode + // The time of the status. + Time *time.Time } -// ClustersClientBeginCreateIdentityOptions contains the optional parameters for the ClustersClient.BeginCreateIdentity method. -type ClustersClientBeginCreateIdentityOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +type InterfaceDNSSettings struct { + // List of DNS server IP Addresses for the interface + DNSServers []*string } -// ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. -type ClustersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// LogicalNetworkProperties - Properties under the logical network resource +type LogicalNetworkProperties struct { + // DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP option for + // a subnet overrides logical network DHCP options. + DhcpOptions *LogicalNetworkPropertiesDhcpOptions + + // Subnet - list of subnets under the logical network + Subnets []*Subnet + + // name of the network switch to be used for VMs + VMSwitchName *string + + // READ-ONLY; Provisioning state of the logical network. + ProvisioningState *ProvisioningStateEnum + + // READ-ONLY; The observed state of logical networks + Status *LogicalNetworkStatus } -// ClustersClientBeginUploadCertificateOptions contains the optional parameters for the ClustersClient.BeginUploadCertificate -// method. -type ClustersClientBeginUploadCertificateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// LogicalNetworkPropertiesDhcpOptions - DhcpOptions contains an array of DNS servers available to VMs deployed in the logical +// network. Standard DHCP option for a subnet overrides logical network DHCP options. +type LogicalNetworkPropertiesDhcpOptions struct { + // The list of DNS servers IP addresses. + DNSServers []*string } -// ClustersClientCreateOptions contains the optional parameters for the ClustersClient.Create method. -type ClustersClientCreateOptions struct { - // placeholder for future optional parameters +// LogicalNetworkStatus - The observed state of logical networks +type LogicalNetworkStatus struct { + // LogicalNetwork provisioning error code + ErrorCode *string + + // Descriptive error message + ErrorMessage *string + ProvisioningStatus *LogicalNetworkStatusProvisioningStatus } -// ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. -type ClustersClientGetOptions struct { - // placeholder for future optional parameters +type LogicalNetworkStatusProvisioningStatus struct { + // The ID of the operation performed on the logical network + OperationID *string + + // The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + Status *Status } -// ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager -// method. -type ClustersClientListByResourceGroupOptions struct { - // placeholder for future optional parameters +// LogicalNetworks - The logical network resource definition. +type LogicalNetworks struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The extendedLocation of the resource. + ExtendedLocation *ExtendedLocation + + // Properties under the logical network resource + Properties *LogicalNetworkProperties + + // Resource tags. + Tags map[string]*string + + // 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; 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 } -// ClustersClientListBySubscriptionOptions contains the optional parameters for the ClustersClient.NewListBySubscriptionPager -// method. -type ClustersClientListBySubscriptionOptions struct { - // placeholder for future optional parameters +type LogicalNetworksListResult struct { + NextLink *string + Value []*LogicalNetworks } -// ClustersClientUpdateOptions contains the optional parameters for the ClustersClient.Update method. -type ClustersClientUpdateOptions struct { - // placeholder for future optional parameters +// LogicalNetworksUpdateRequest - The logical network resource patch definition. +type LogicalNetworksUpdateRequest struct { + // Resource tags + Tags map[string]*string } -// ErrorAdditionalInfo - The resource management error additional info. -type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. - Info any +// MarketplaceGalleryImageProperties - Properties under the marketplace gallery image resource +type MarketplaceGalleryImageProperties struct { + // REQUIRED; Operating system type that the gallery image uses [Windows, Linux] + OSType *OperatingSystemTypes - // READ-ONLY; The additional info type. - Type *string + // Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + CloudInitDataSource *CloudInitDataSource + + // Storage ContainerID of the storage container to be used for marketplace gallery image + ContainerID *string + + // The hypervisor generation of the Virtual Machine [V1, V2] + HyperVGeneration *HyperVGeneration + + // This is the gallery image definition identifier. + Identifier *GalleryImageIdentifier + + // Specifies information about the gallery image version that you want to create or update. + Version *GalleryImageVersion + + // READ-ONLY; Provisioning state of the marketplace gallery image. + ProvisioningState *ProvisioningStateEnum + + // READ-ONLY; The observed state of marketplace gallery images + Status *MarketplaceGalleryImageStatus } -// ErrorDetail - The error detail. -type ErrorDetail struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo +// MarketplaceGalleryImageStatus - The observed state of marketplace gallery images +type MarketplaceGalleryImageStatus struct { + // The download status of the gallery image + DownloadStatus *MarketplaceGalleryImageStatusDownloadStatus - // READ-ONLY; The error code. - Code *string + // MarketplaceGalleryImage provisioning error code + ErrorCode *string - // READ-ONLY; The error details. - Details []*ErrorDetail + // Descriptive error message + ErrorMessage *string - // READ-ONLY; The error message. - Message *string + // The progress of the operation in percentage + ProgressPercentage *int64 + ProvisioningStatus *MarketplaceGalleryImageStatusProvisioningStatus +} - // READ-ONLY; The error target. - Target *string +// MarketplaceGalleryImageStatusDownloadStatus - The download status of the gallery image +type MarketplaceGalleryImageStatusDownloadStatus struct { + // The downloaded sized of the image in MB + DownloadSizeInMB *int64 } -// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type ErrorResponse struct { - // The error object. - Error *ErrorDetail +type MarketplaceGalleryImageStatusProvisioningStatus struct { + // The ID of the operation performed on the gallery image + OperationID *string + + // The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + Status *Status } -// Extension - Details of a particular extension in HCI Cluster. -type Extension struct { - // Describes Machine Extension Properties. - Properties *ExtensionProperties +// MarketplaceGalleryImages - The marketplace gallery image resource definition. +type MarketplaceGalleryImages struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The extendedLocation of the resource. + ExtendedLocation *ExtendedLocation + + // Properties under the marketplace gallery image resource + Properties *MarketplaceGalleryImageProperties + + // Resource tags. + Tags map[string]*string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string @@ -419,90 +569,107 @@ type Extension struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; System data of Extension resource. + // 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 } -// ExtensionList - List of Extensions in HCI cluster. -type ExtensionList struct { - // READ-ONLY; Link to the next set of results. +type MarketplaceGalleryImagesListResult struct { NextLink *string + Value []*MarketplaceGalleryImages +} - // READ-ONLY; List of Extensions in HCI cluster. - Value []*Extension +// MarketplaceGalleryImagesUpdateRequest - The marketplace gallery image resource patch definition. +type MarketplaceGalleryImagesUpdateRequest struct { + // Resource tags + Tags map[string]*string } -// ExtensionParameters - Describes the properties of a Machine Extension. This object mirrors the definition in HybridCompute. -type ExtensionParameters 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 +// NetworkInterfaceProperties - Properties under the network interface resource +type NetworkInterfaceProperties struct { + // DNS Settings for the interface + DNSSettings *InterfaceDNSSettings - // How the extension handler should be forced to update even if the extension configuration has not changed. - ForceUpdateTag *string + // IPConfigurations - A list of IPConfigurations of the network interface. + IPConfigurations []*IPConfiguration - // Protected settings (may contain secrets). - ProtectedSettings any + // MacAddress - The MAC address of the network interface. + MacAddress *string - // The name of the extension handler publisher. - Publisher *string + // READ-ONLY; Provisioning state of the network interface. + ProvisioningState *ProvisioningStateEnum - // Json formatted public settings for the extension. - Settings any + // READ-ONLY; The observed state of network interfaces + Status *NetworkInterfaceStatus +} - // Specifies the type of the extension; an example is "CustomScriptExtension". - Type *string +// NetworkInterfaceStatus - The observed state of network interfaces +type NetworkInterfaceStatus struct { + // NetworkInterface provisioning error code + ErrorCode *string - // Specifies the version of the script handler. - TypeHandlerVersion *string + // Descriptive error message + ErrorMessage *string + ProvisioningStatus *NetworkInterfaceStatusProvisioningStatus } -// ExtensionProperties - Status of Arc Extension for a particular node in HCI Cluster. -type ExtensionProperties struct { - // Parameters specific to this extension type. - ExtensionParameters *ExtensionParameters +type NetworkInterfaceStatusProvisioningStatus struct { + // The ID of the operation performed on the network interface + OperationID *string + + // The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + Status *Status +} - // READ-ONLY; Aggregate state of Arc Extensions across the nodes in this HCI cluster. - AggregateState *ExtensionAggregateState +// NetworkInterfaces - The network interface resource definition. +type NetworkInterfaces struct { + // REQUIRED; The geo-location where the resource lives + Location *string - // READ-ONLY; State of Arc Extension in each of the nodes. - PerNodeExtensionDetails []*PerNodeExtensionState + // The extendedLocation of the resource. + ExtendedLocation *ExtendedLocation - // READ-ONLY; Provisioning state of the Extension proxy resource. - ProvisioningState *ProvisioningState -} + // Properties under the network interface resource + Properties *NetworkInterfaceProperties -// ExtensionsClientBeginCreateOptions contains the optional parameters for the ExtensionsClient.BeginCreate method. -type ExtensionsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + // Resource tags. + Tags map[string]*string + + // 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; 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 } -// ExtensionsClientBeginDeleteOptions contains the optional parameters for the ExtensionsClient.BeginDelete method. -type ExtensionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +type NetworkInterfacesListResult struct { + NextLink *string + Value []*NetworkInterfaces } -// ExtensionsClientBeginUpdateOptions contains the optional parameters for the ExtensionsClient.BeginUpdate method. -type ExtensionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// NetworkInterfacesUpdateRequest - The network interface resource patch definition. +type NetworkInterfacesUpdateRequest struct { + // Resource tags + Tags map[string]*string } -// ExtensionsClientGetOptions contains the optional parameters for the ExtensionsClient.Get method. -type ExtensionsClientGetOptions struct { - // placeholder for future optional parameters +// NetworkProfileUpdate - NetworkProfile - describes the network update configuration the virtual machine instance +type NetworkProfileUpdate struct { + // NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + NetworkInterfaces []*NetworkProfileUpdateNetworkInterfacesItem } -// ExtensionsClientListByArcSettingOptions contains the optional parameters for the ExtensionsClient.NewListByArcSettingPager -// method. -type ExtensionsClientListByArcSettingOptions struct { - // placeholder for future optional parameters +type NetworkProfileUpdateNetworkInterfacesItem struct { + // ID - Resource ID of the network interface + ID *string } // Operation - Details of a REST API operation, returned from the Resource Provider Operations API @@ -554,69 +721,210 @@ type OperationListResult struct { Value []*Operation } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters +// OsProfileUpdate - OsProfile - describes the update configuration of the operating system +type OsProfileUpdate struct { + // ComputerName - name of the computer + ComputerName *string + LinuxConfiguration *OsProfileUpdateLinuxConfiguration + WindowsConfiguration *OsProfileUpdateWindowsConfiguration } -type PasswordCredential struct { - EndDateTime *time.Time - KeyID *string - SecretText *string - StartDateTime *time.Time +type OsProfileUpdateLinuxConfiguration struct { + // Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + // process. + ProvisionVMAgent *bool + + // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ProvisionVMConfigAgent *bool } -// PerNodeExtensionState - Status of Arc Extension for a particular node in HCI Cluster. -type PerNodeExtensionState struct { - // READ-ONLY; Fully qualified resource ID for the particular Arc Extension on this node. - Extension *string +type OsProfileUpdateWindowsConfiguration struct { + // Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + // process. + ProvisionVMAgent *bool + + // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ProvisionVMConfigAgent *bool +} - // READ-ONLY; Name of the node in HCI Cluster. +// Route - Route resource. +type Route struct { + // Name - name of the subnet Name *string - // READ-ONLY; State of Arc Extension in this node. - State *NodeExtensionState + // Properties of the route. + Properties *RoutePropertiesFormat } -// PerNodeState - Status of Arc agent for a particular node in HCI Cluster. -type PerNodeState struct { - // READ-ONLY; Fully qualified resource ID for the Arc agent of this node. - ArcInstance *string +// RoutePropertiesFormat - Route resource. +type RoutePropertiesFormat struct { + // The destination CIDR to which the route applies. + AddressPrefix *string - // READ-ONLY; Name of the Node in HCI Cluster + // The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + NextHopIPAddress *string +} + +// RouteTable - Route table resource. +type RouteTable struct { + // Properties of the route table. + Properties *RouteTablePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. Name *string - // READ-ONLY; State of Arc agent in this node. - State *NodeArcState + // READ-ONLY; Resource type. + Type *string +} + +// RouteTablePropertiesFormat - Route Table resource. +type RouteTablePropertiesFormat struct { + // Collection of routes contained within a route table. + Routes []*Route +} + +// SSHConfiguration - SSH configuration for Linux based VMs running on Azure +type SSHConfiguration struct { + // The list of SSH public keys used to authenticate with linux based VMs. + PublicKeys []*SSHPublicKey +} + +// SSHPublicKey - Contains information about SSH certificate public key and the path on the Linux VM where the public key +// is placed. +type SSHPublicKey struct { + // SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa + // format. + // For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + KeyData *string + + // Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key + // is appended to the file. Example: /home/user/.ssh/authorized_keys + Path *string +} + +// StorageContainerProperties - Properties under the storage container resource +type StorageContainerProperties struct { + // REQUIRED; Path of the storage container on the disk + Path *string + + // READ-ONLY; Provisioning state of the storage container. + ProvisioningState *ProvisioningStateEnum + + // READ-ONLY; The observed state of storage containers + Status *StorageContainerStatus } -// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a -// location -type ProxyResource struct { +// StorageContainerStatus - The observed state of storage containers +type StorageContainerStatus struct { + // Amount of space available on the disk in MB + AvailableSizeMB *int64 + + // Total size of the disk in MB + ContainerSizeMB *int64 + + // StorageContainer provisioning error code + ErrorCode *string + + // Descriptive error message + ErrorMessage *string + ProvisioningStatus *StorageContainerStatusProvisioningStatus +} + +type StorageContainerStatusProvisioningStatus struct { + // The ID of the operation performed on the storage container + OperationID *string + + // The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + Status *Status +} + +// StorageContainers - The storage container resource definition. +type StorageContainers struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The extendedLocation of the resource. + ExtendedLocation *ExtendedLocation + + // Properties under the storage container resource + Properties *StorageContainerProperties + + // Resource tags. + Tags map[string]*string + // 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; 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 } -type RawCertificateData struct { - Certificates []*string +type StorageContainersListResult struct { + NextLink *string + Value []*StorageContainers } -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// StorageContainersUpdateRequest - The storage container resource patch definition. +type StorageContainersUpdateRequest struct { + // Resource tags + Tags map[string]*string +} + +type StorageProfileUpdate struct { + // adds data disks to the virtual machine instance for the update call + DataDisks []*StorageProfileUpdateDataDisksItem +} + +type StorageProfileUpdateDataDisksItem struct { ID *string +} - // READ-ONLY; The name of the resource +type Subnet struct { + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. Name *string - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string + // Properties of the subnet. + Properties *SubnetPropertiesFormat +} + +// SubnetPropertiesFormat - Properties of the subnet. +type SubnetPropertiesFormat struct { + // The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + AddressPrefix *string + + // List of address prefixes for the subnet. + AddressPrefixes []*string + + // IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + IPAllocationMethod *IPAllocationMethodEnum + + // IPConfigurationReferences - list of IPConfigurationReferences + IPConfigurationReferences []*SubnetPropertiesFormatIPConfigurationReferencesItem + + // network associated pool of IP Addresses + IPPools []*IPPool + + // Route table resource. + RouteTable *RouteTable + + // Vlan to use for the subnet + Vlan *int32 +} + +// SubnetPropertiesFormatIPConfigurationReferencesItem - IPConfigurationReference - Describes a IPConfiguration under the +// virtual network +type SubnetPropertiesFormatIPConfigurationReferencesItem struct { + // IPConfigurationID + ID *string } // SystemData - Metadata pertaining to creation and last modification of the resource. @@ -640,12 +948,63 @@ type SystemData struct { LastModifiedByType *CreatedByType } -// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' -// and a 'location' -type TrackedResource struct { +// VirtualHardDiskProperties - Properties under the virtual hard disk resource +type VirtualHardDiskProperties struct { + BlockSizeBytes *int32 + + // Storage ContainerID of the storage container to be used for VHD + ContainerID *string + + // The format of the actual VHD file [vhd, vhdx] + DiskFileFormat *DiskFileFormat + + // Size of the disk in GB + DiskSizeGB *int64 + + // Boolean for enabling dynamic sizing on the virtual hard disk + Dynamic *bool + + // The hypervisor generation of the Virtual Machine [V1, V2] + HyperVGeneration *HyperVGeneration + LogicalSectorBytes *int32 + PhysicalSectorBytes *int32 + + // READ-ONLY; Provisioning state of the virtual hard disk. + ProvisioningState *ProvisioningStateEnum + + // READ-ONLY; The observed state of virtual hard disks + Status *VirtualHardDiskStatus +} + +// VirtualHardDiskStatus - The observed state of virtual hard disks +type VirtualHardDiskStatus struct { + // VirtualHardDisk provisioning error code + ErrorCode *string + + // Descriptive error message + ErrorMessage *string + ProvisioningStatus *VirtualHardDiskStatusProvisioningStatus +} + +type VirtualHardDiskStatusProvisioningStatus struct { + // The ID of the operation performed on the virtual hard disk + OperationID *string + + // The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + Status *Status +} + +// VirtualHardDisks - The virtual hard disk resource definition. +type VirtualHardDisks struct { // REQUIRED; The geo-location where the resource lives Location *string + // The extendedLocation of the resource. + ExtendedLocation *ExtendedLocation + + // Properties under the virtual hard disk resource + Properties *VirtualHardDiskProperties + // Resource tags. Tags map[string]*string @@ -655,10 +1014,289 @@ type TrackedResource struct { // 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 +} + +type VirtualHardDisksListResult struct { + NextLink *string + Value []*VirtualHardDisks +} + +// VirtualHardDisksUpdateRequest - The virtual hard disk resource patch definition. +type VirtualHardDisksUpdateRequest struct { + // Resource tags + Tags map[string]*string +} + +// VirtualMachineConfigAgentInstanceView - The instance view of the VM Config Agent running on the virtual machine. +type VirtualMachineConfigAgentInstanceView struct { + // The resource status information. + Statuses []*InstanceViewStatus + + // The VM Config Agent full version. + VMConfigAgentVersion *string +} + +// VirtualMachineInstance - The virtual machine instance resource definition. +type VirtualMachineInstance struct { + // The extendedLocation of the resource. + ExtendedLocation *ExtendedLocation + + // Identity for the resource. + Identity *Identity + + // Properties under the virtual machine instance resource + Properties *VirtualMachineInstanceProperties + + // 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; 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 } -type UploadCertificateRequest struct { - Properties *RawCertificateData +type VirtualMachineInstanceListResult struct { + NextLink *string + Value []*VirtualMachineInstance +} + +// VirtualMachineInstanceProperties - Properties under the virtual machine instance resource +type VirtualMachineInstanceProperties struct { + // Guest agent install status. + GuestAgentInstallStatus *GuestAgentInstallStatus + + // HTTP Proxy configuration for the VM. + HTTPProxyConfig *HTTPProxyConfiguration + + // HardwareProfile - Specifies the hardware settings for the virtual machine instance. + HardwareProfile *VirtualMachineInstancePropertiesHardwareProfile + + // NetworkProfile - describes the network configuration the virtual machine instance + NetworkProfile *VirtualMachineInstancePropertiesNetworkProfile + + // OsProfile - describes the configuration of the operating system and sets login data + OSProfile *VirtualMachineInstancePropertiesOsProfile + + // Unique identifier defined by ARC to identify the guest of the VM. + ResourceUID *string + + // SecurityProfile - Specifies the security settings for the virtual machine instance. + SecurityProfile *VirtualMachineInstancePropertiesSecurityProfile + + // StorageProfile - contains information about the disks and storage information for the virtual machine instance + StorageProfile *VirtualMachineInstancePropertiesStorageProfile + + // READ-ONLY; The virtual machine instance view. + InstanceView *VirtualMachineInstanceView + + // READ-ONLY; Provisioning state of the virtual machine instance. + ProvisioningState *ProvisioningStateEnum + + // READ-ONLY; The observed state of virtual machine instances + Status *VirtualMachineInstanceStatus + + // READ-ONLY; Unique identifier for the vm resource. + VMID *string +} + +// VirtualMachineInstancePropertiesHardwareProfile - HardwareProfile - Specifies the hardware settings for the virtual machine +// instance. +type VirtualMachineInstancePropertiesHardwareProfile struct { + DynamicMemoryConfig *VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig + + // RAM in MB for the virtual machine instance + MemoryMB *int64 + + // number of processors for the virtual machine instance + Processors *int32 + VMSize *VMSizeEnum +} + +type VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig struct { + MaximumMemoryMB *int64 + MinimumMemoryMB *int64 + + // Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage of + // the total memory that the virtual machine instance is thought to need. This + // only applies to virtual systems with dynamic memory enabled. This property can be in the range of 5 to 2000. + TargetMemoryBuffer *int32 +} + +// VirtualMachineInstancePropertiesNetworkProfile - NetworkProfile - describes the network configuration the virtual machine +// instance +type VirtualMachineInstancePropertiesNetworkProfile struct { + // NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + NetworkInterfaces []*VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem +} + +type VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem struct { + // ID - Resource Id of the network interface + ID *string +} + +// VirtualMachineInstancePropertiesOsProfile - OsProfile - describes the configuration of the operating system and sets login +// data +type VirtualMachineInstancePropertiesOsProfile struct { + // AdminPassword - admin password + AdminPassword *string + + // AdminUsername - admin username + AdminUsername *string + + // ComputerName - name of the compute + ComputerName *string + + // LinuxConfiguration - linux specific configuration values for the virtual machine instance + LinuxConfiguration *VirtualMachineInstancePropertiesOsProfileLinuxConfiguration + + // Windows Configuration for the virtual machine instance + WindowsConfiguration *VirtualMachineInstancePropertiesOsProfileWindowsConfiguration +} + +// VirtualMachineInstancePropertiesOsProfileLinuxConfiguration - LinuxConfiguration - linux specific configuration values +// for the virtual machine instance +type VirtualMachineInstancePropertiesOsProfileLinuxConfiguration struct { + // DisablePasswordAuthentication - whether password authentication should be disabled + DisablePasswordAuthentication *bool + + // Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + // process. + ProvisionVMAgent *bool + + // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ProvisionVMConfigAgent *bool + + // Specifies the ssh key configuration for a Linux OS. + SSH *SSHConfiguration +} + +// VirtualMachineInstancePropertiesOsProfileWindowsConfiguration - Windows Configuration for the virtual machine instance +type VirtualMachineInstancePropertiesOsProfileWindowsConfiguration struct { + // Whether to EnableAutomaticUpdates on the machine + EnableAutomaticUpdates *bool + + // Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + // process. + ProvisionVMAgent *bool + + // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ProvisionVMConfigAgent *bool + + // Specifies the ssh key configuration for Windows OS. + SSH *SSHConfiguration + + // TimeZone for the virtual machine instance + TimeZone *string +} + +// VirtualMachineInstancePropertiesSecurityProfile - SecurityProfile - Specifies the security settings for the virtual machine +// instance. +type VirtualMachineInstancePropertiesSecurityProfile struct { + EnableTPM *bool + + // Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + // to function. + SecurityType *SecurityTypes + UefiSettings *VirtualMachineInstancePropertiesSecurityProfileUefiSettings +} + +type VirtualMachineInstancePropertiesSecurityProfileUefiSettings struct { + // Specifies whether secure boot should be enabled on the virtual machine instance. + SecureBootEnabled *bool +} + +// VirtualMachineInstancePropertiesStorageProfile - StorageProfile - contains information about the disks and storage information +// for the virtual machine instance +type VirtualMachineInstancePropertiesStorageProfile struct { + // adds data disks to the virtual machine instance + DataDisks []*VirtualMachineInstancePropertiesStorageProfileDataDisksItem + + // Which Image to use for the virtual machine instance + ImageReference *VirtualMachineInstancePropertiesStorageProfileImageReference + + // VHD to attach as OS disk + OSDisk *VirtualMachineInstancePropertiesStorageProfileOsDisk + + // Id of the storage container that hosts the VM configuration file + VMConfigStoragePathID *string +} + +type VirtualMachineInstancePropertiesStorageProfileDataDisksItem struct { + // Resource ID of the data disk + ID *string +} + +// VirtualMachineInstancePropertiesStorageProfileImageReference - Which Image to use for the virtual machine instance +type VirtualMachineInstancePropertiesStorageProfileImageReference struct { + // Resource ID of the image + ID *string +} + +// VirtualMachineInstancePropertiesStorageProfileOsDisk - VHD to attach as OS disk +type VirtualMachineInstancePropertiesStorageProfileOsDisk struct { + // Resource ID of the OS disk + ID *string + + // This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + // a specialized VHD. Possible values are: Windows, Linux. + OSType *OperatingSystemTypes +} + +// VirtualMachineInstanceStatus - The observed state of virtual machine instances +type VirtualMachineInstanceStatus struct { + // VirtualMachine provisioning error code + ErrorCode *string + + // Descriptive error message + ErrorMessage *string + + // The power state of the virtual machine instance + PowerState *PowerStateEnum + ProvisioningStatus *VirtualMachineInstanceStatusProvisioningStatus +} + +type VirtualMachineInstanceStatusProvisioningStatus struct { + // The ID of the operation performed on the virtual machine instance + OperationID *string + + // The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + Status *Status +} + +// VirtualMachineInstanceUpdateProperties - Defines the resource properties for the update. +type VirtualMachineInstanceUpdateProperties struct { + // HardwareProfile - Specifies the hardware settings for the virtual machine instance. + HardwareProfile *HardwareProfileUpdate + + // NetworkProfile - describes the network update configuration the virtual machine instance + NetworkProfile *NetworkProfileUpdate + + // OsProfile - describes the update configuration of the operating system + OSProfile *OsProfileUpdate + StorageProfile *StorageProfileUpdate +} + +// VirtualMachineInstanceUpdateRequest - The virtual machine instance resource patch definition. +type VirtualMachineInstanceUpdateRequest struct { + // Identity for the resource. + Identity *Identity + + // Defines the resource properties for the update. + Properties *VirtualMachineInstanceUpdateProperties +} + +// VirtualMachineInstanceView - The instance view of a virtual machine. +type VirtualMachineInstanceView struct { + // The VM Config Agent running on the virtual machine. + VMAgent *VirtualMachineConfigAgentInstanceView } diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go index 9ec0dc773d5d..c4d8973429ba 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armazurestackhci @@ -16,1436 +15,3830 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type ArcConnectivityProperties. -func (a ArcConnectivityProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", a.Enabled) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcConnectivityProperties. -func (a *ArcConnectivityProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ArcIdentityResponse. -func (a ArcIdentityResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcIdentityResponse. -func (a *ArcIdentityResponse) UnmarshalJSON(data []byte) error { +// 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", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ArcIdentityResponseProperties. -func (a ArcIdentityResponseProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. +func (e ExtendedLocation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "arcApplicationClientId", a.ArcApplicationClientID) - populate(objectMap, "arcApplicationObjectId", a.ArcApplicationObjectID) - populate(objectMap, "arcApplicationTenantId", a.ArcApplicationTenantID) - populate(objectMap, "arcServicePrincipalObjectId", a.ArcServicePrincipalObjectID) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcIdentityResponseProperties. -func (a *ArcIdentityResponseProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. +func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "arcApplicationClientId": - err = unpopulate(val, "ArcApplicationClientID", &a.ArcApplicationClientID) - delete(rawMsg, key) - case "arcApplicationObjectId": - err = unpopulate(val, "ArcApplicationObjectID", &a.ArcApplicationObjectID) - delete(rawMsg, key) - case "arcApplicationTenantId": - err = unpopulate(val, "ArcApplicationTenantID", &a.ArcApplicationTenantID) + case "name": + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - case "arcServicePrincipalObjectId": - err = unpopulate(val, "ArcServicePrincipalObjectID", &a.ArcServicePrincipalObjectID) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ArcSetting. -func (a ArcSetting) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImageIdentifier. +func (g GalleryImageIdentifier) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) + populate(objectMap, "offer", g.Offer) + populate(objectMap, "publisher", g.Publisher) + populate(objectMap, "sku", g.SKU) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSetting. -func (a *ArcSetting) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageIdentifier. +func (g *GalleryImageIdentifier) 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) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "offer": + err = unpopulate(val, "Offer", &g.Offer) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) + case "publisher": + err = unpopulate(val, "Publisher", &g.Publisher) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "sku": + err = unpopulate(val, "SKU", &g.SKU) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ArcSettingList. -func (a ArcSettingList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImageProperties. +func (g GalleryImageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) + populate(objectMap, "cloudInitDataSource", g.CloudInitDataSource) + populate(objectMap, "containerId", g.ContainerID) + populate(objectMap, "hyperVGeneration", g.HyperVGeneration) + populate(objectMap, "identifier", g.Identifier) + populate(objectMap, "imagePath", g.ImagePath) + populate(objectMap, "osType", g.OSType) + populate(objectMap, "provisioningState", g.ProvisioningState) + populate(objectMap, "status", g.Status) + populate(objectMap, "version", g.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingList. -func (a *ArcSettingList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageProperties. +func (g *GalleryImageProperties) 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) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) + case "cloudInitDataSource": + err = unpopulate(val, "CloudInitDataSource", &g.CloudInitDataSource) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) + case "containerId": + err = unpopulate(val, "ContainerID", &g.ContainerID) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &g.HyperVGeneration) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, "Identifier", &g.Identifier) + delete(rawMsg, key) + case "imagePath": + err = unpopulate(val, "ImagePath", &g.ImagePath) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &g.OSType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &g.Status) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &g.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ArcSettingProperties. -func (a ArcSettingProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatus. +func (g GalleryImageStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "aggregateState", a.AggregateState) - populate(objectMap, "arcApplicationClientId", a.ArcApplicationClientID) - populate(objectMap, "arcApplicationObjectId", a.ArcApplicationObjectID) - populate(objectMap, "arcApplicationTenantId", a.ArcApplicationTenantID) - populate(objectMap, "arcInstanceResourceGroup", a.ArcInstanceResourceGroup) - populate(objectMap, "arcServicePrincipalObjectId", a.ArcServicePrincipalObjectID) - populateAny(objectMap, "connectivityProperties", a.ConnectivityProperties) - populate(objectMap, "perNodeDetails", a.PerNodeDetails) - populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "downloadStatus", g.DownloadStatus) + populate(objectMap, "errorCode", g.ErrorCode) + populate(objectMap, "errorMessage", g.ErrorMessage) + populate(objectMap, "progressPercentage", g.ProgressPercentage) + populate(objectMap, "provisioningStatus", g.ProvisioningStatus) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingProperties. -func (a *ArcSettingProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageStatus. +func (g *GalleryImageStatus) 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) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "aggregateState": - err = unpopulate(val, "AggregateState", &a.AggregateState) - delete(rawMsg, key) - case "arcApplicationClientId": - err = unpopulate(val, "ArcApplicationClientID", &a.ArcApplicationClientID) - delete(rawMsg, key) - case "arcApplicationObjectId": - err = unpopulate(val, "ArcApplicationObjectID", &a.ArcApplicationObjectID) - delete(rawMsg, key) - case "arcApplicationTenantId": - err = unpopulate(val, "ArcApplicationTenantID", &a.ArcApplicationTenantID) - delete(rawMsg, key) - case "arcInstanceResourceGroup": - err = unpopulate(val, "ArcInstanceResourceGroup", &a.ArcInstanceResourceGroup) + case "downloadStatus": + err = unpopulate(val, "DownloadStatus", &g.DownloadStatus) delete(rawMsg, key) - case "arcServicePrincipalObjectId": - err = unpopulate(val, "ArcServicePrincipalObjectID", &a.ArcServicePrincipalObjectID) + case "errorCode": + err = unpopulate(val, "ErrorCode", &g.ErrorCode) delete(rawMsg, key) - case "connectivityProperties": - err = unpopulate(val, "ConnectivityProperties", &a.ConnectivityProperties) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &g.ErrorMessage) delete(rawMsg, key) - case "perNodeDetails": - err = unpopulate(val, "PerNodeDetails", &a.PerNodeDetails) + case "progressPercentage": + err = unpopulate(val, "ProgressPercentage", &g.ProgressPercentage) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &g.ProvisioningStatus) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ArcSettingsPatch. -func (a ArcSettingsPatch) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatusDownloadStatus. +func (g GalleryImageStatusDownloadStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) + populate(objectMap, "downloadSizeInMB", g.DownloadSizeInMB) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingsPatch. -func (a *ArcSettingsPatch) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageStatusDownloadStatus. +func (g *GalleryImageStatusDownloadStatus) 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) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "downloadSizeInMB": + err = unpopulate(val, "DownloadSizeInMB", &g.DownloadSizeInMB) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ArcSettingsPatchProperties. -func (a ArcSettingsPatchProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatusProvisioningStatus. +func (g GalleryImageStatusProvisioningStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "connectivityProperties", a.ConnectivityProperties) + populate(objectMap, "operationId", g.OperationID) + populate(objectMap, "status", g.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingsPatchProperties. -func (a *ArcSettingsPatchProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageStatusProvisioningStatus. +func (g *GalleryImageStatusProvisioningStatus) 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) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "connectivityProperties": - err = unpopulate(val, "ConnectivityProperties", &a.ConnectivityProperties) + case "operationId": + err = unpopulate(val, "OperationID", &g.OperationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &g.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Cluster. -func (c Cluster) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersion. +func (g GalleryImageVersion) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "type", c.Type) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Cluster. -func (c *Cluster) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersion. +func (g *GalleryImageVersion) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &c.Location) - delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &c.Name) + err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &c.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClusterDesiredProperties. -func (c ClusterDesiredProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionProperties. +func (g GalleryImageVersionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "diagnosticLevel", c.DiagnosticLevel) - populate(objectMap, "windowsServerSubscription", c.WindowsServerSubscription) + populate(objectMap, "storageProfile", g.StorageProfile) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterDesiredProperties. -func (c *ClusterDesiredProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionProperties. +func (g *GalleryImageVersionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "diagnosticLevel": - err = unpopulate(val, "DiagnosticLevel", &c.DiagnosticLevel) - delete(rawMsg, key) - case "windowsServerSubscription": - err = unpopulate(val, "WindowsServerSubscription", &c.WindowsServerSubscription) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &g.StorageProfile) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClusterIdentityResponse. -func (c ClusterIdentityResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionStorageProfile. +func (g GalleryImageVersionStorageProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", c.Properties) + populate(objectMap, "osDiskImage", g.OSDiskImage) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterIdentityResponse. -func (c *ClusterIdentityResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionStorageProfile. +func (g *GalleryImageVersionStorageProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "osDiskImage": + err = unpopulate(val, "OSDiskImage", &g.OSDiskImage) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClusterIdentityResponseProperties. -func (c ClusterIdentityResponseProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImages. +func (g GalleryImages) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "aadApplicationObjectId", c.AADApplicationObjectID) - populate(objectMap, "aadClientId", c.AADClientID) - populate(objectMap, "aadServicePrincipalObjectId", c.AADServicePrincipalObjectID) - populate(objectMap, "aadTenantId", c.AADTenantID) + populate(objectMap, "extendedLocation", g.ExtendedLocation) + populate(objectMap, "id", g.ID) + populate(objectMap, "location", g.Location) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterIdentityResponseProperties. -func (c *ClusterIdentityResponseProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImages. +func (g *GalleryImages) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "aadApplicationObjectId": - err = unpopulate(val, "AADApplicationObjectID", &c.AADApplicationObjectID) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &g.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) - case "aadClientId": - err = unpopulate(val, "AADClientID", &c.AADClientID) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) delete(rawMsg, key) - case "aadServicePrincipalObjectId": - err = unpopulate(val, "AADServicePrincipalObjectID", &c.AADServicePrincipalObjectID) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) delete(rawMsg, key) - case "aadTenantId": - err = unpopulate(val, "AADTenantID", &c.AADTenantID) + case "type": + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClusterList. -func (c ClusterList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImagesListResult. +func (g GalleryImagesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterList. -func (c *ClusterList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImagesListResult. +func (g *GalleryImagesListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) + err = unpopulate(val, "NextLink", &g.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &c.Value) + err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClusterNode. -func (c ClusterNode) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImagesUpdateRequest. +func (g GalleryImagesUpdateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "coreCount", c.CoreCount) - populate(objectMap, "id", c.ID) - populate(objectMap, "manufacturer", c.Manufacturer) - populate(objectMap, "memoryInGiB", c.MemoryInGiB) - populate(objectMap, "model", c.Model) - populate(objectMap, "name", c.Name) - populate(objectMap, "osName", c.OSName) - populate(objectMap, "osVersion", c.OSVersion) - populate(objectMap, "serialNumber", c.SerialNumber) - populate(objectMap, "windowsServerSubscription", c.WindowsServerSubscription) + populate(objectMap, "tags", g.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterNode. -func (c *ClusterNode) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImagesUpdateRequest. +func (g *GalleryImagesUpdateRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "coreCount": - err = unpopulate(val, "CoreCount", &c.CoreCount) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "manufacturer": - err = unpopulate(val, "Manufacturer", &c.Manufacturer) - delete(rawMsg, key) - case "memoryInGiB": - err = unpopulate(val, "MemoryInGiB", &c.MemoryInGiB) - delete(rawMsg, key) - case "model": - err = unpopulate(val, "Model", &c.Model) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "osName": - err = unpopulate(val, "OSName", &c.OSName) - delete(rawMsg, key) - case "osVersion": - err = unpopulate(val, "OSVersion", &c.OSVersion) - delete(rawMsg, key) - case "serialNumber": - err = unpopulate(val, "SerialNumber", &c.SerialNumber) - delete(rawMsg, key) - case "windowsServerSubscription": - err = unpopulate(val, "WindowsServerSubscription", &c.WindowsServerSubscription) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClusterPatch. -func (c ClusterPatch) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryOSDiskImage. +func (g GalleryOSDiskImage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "tags", c.Tags) + populate(objectMap, "sizeInMB", g.SizeInMB) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPatch. -func (c *ClusterPatch) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryOSDiskImage. +func (g *GalleryOSDiskImage) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &c.Tags) + case "sizeInMB": + err = unpopulate(val, "SizeInMB", &g.SizeInMB) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClusterPatchProperties. -func (c ClusterPatchProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GuestAgent. +func (g GuestAgent) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "aadClientId", c.AADClientID) - populate(objectMap, "aadTenantId", c.AADTenantID) - populate(objectMap, "cloudManagementEndpoint", c.CloudManagementEndpoint) - populate(objectMap, "desiredProperties", c.DesiredProperties) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) + populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPatchProperties. -func (c *ClusterPatchProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgent. +func (g *GuestAgent) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "aadClientId": - err = unpopulate(val, "AADClientID", &c.AADClientID) + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) - case "aadTenantId": - err = unpopulate(val, "AADTenantID", &c.AADTenantID) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) - case "cloudManagementEndpoint": - err = unpopulate(val, "CloudManagementEndpoint", &c.CloudManagementEndpoint) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) delete(rawMsg, key) - case "desiredProperties": - err = unpopulate(val, "DesiredProperties", &c.DesiredProperties) + case "type": + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClusterProperties. -func (c ClusterProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GuestAgentInstallStatus. +func (g GuestAgentInstallStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "aadApplicationObjectId", c.AADApplicationObjectID) - populate(objectMap, "aadClientId", c.AADClientID) - populate(objectMap, "aadServicePrincipalObjectId", c.AADServicePrincipalObjectID) - populate(objectMap, "aadTenantId", c.AADTenantID) - populate(objectMap, "billingModel", c.BillingModel) - populate(objectMap, "cloudId", c.CloudID) - populate(objectMap, "cloudManagementEndpoint", c.CloudManagementEndpoint) - populate(objectMap, "desiredProperties", c.DesiredProperties) - populateTimeRFC3339(objectMap, "lastBillingTimestamp", c.LastBillingTimestamp) - populateTimeRFC3339(objectMap, "lastSyncTimestamp", c.LastSyncTimestamp) - populate(objectMap, "provisioningState", c.ProvisioningState) - populateTimeRFC3339(objectMap, "registrationTimestamp", c.RegistrationTimestamp) - populate(objectMap, "reportedProperties", c.ReportedProperties) - populate(objectMap, "serviceEndpoint", c.ServiceEndpoint) - populate(objectMap, "status", c.Status) - populate(objectMap, "trialDaysRemaining", c.TrialDaysRemaining) + 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 ClusterProperties. -func (c *ClusterProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentInstallStatus. +func (g *GuestAgentInstallStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "aadApplicationObjectId": - err = unpopulate(val, "AADApplicationObjectID", &c.AADApplicationObjectID) - delete(rawMsg, key) - case "aadClientId": - err = unpopulate(val, "AADClientID", &c.AADClientID) - delete(rawMsg, key) - case "aadServicePrincipalObjectId": - err = unpopulate(val, "AADServicePrincipalObjectID", &c.AADServicePrincipalObjectID) - delete(rawMsg, key) - case "aadTenantId": - err = unpopulate(val, "AADTenantID", &c.AADTenantID) - delete(rawMsg, key) - case "billingModel": - err = unpopulate(val, "BillingModel", &c.BillingModel) - delete(rawMsg, key) - case "cloudId": - err = unpopulate(val, "CloudID", &c.CloudID) - delete(rawMsg, key) - case "cloudManagementEndpoint": - err = unpopulate(val, "CloudManagementEndpoint", &c.CloudManagementEndpoint) + case "agentVersion": + err = unpopulate(val, "AgentVersion", &g.AgentVersion) delete(rawMsg, key) - case "desiredProperties": - err = unpopulate(val, "DesiredProperties", &c.DesiredProperties) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &g.ErrorDetails) delete(rawMsg, key) - case "lastBillingTimestamp": - err = unpopulateTimeRFC3339(val, "LastBillingTimestamp", &c.LastBillingTimestamp) - delete(rawMsg, key) - case "lastSyncTimestamp": - err = unpopulateTimeRFC3339(val, "LastSyncTimestamp", &c.LastSyncTimestamp) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) - delete(rawMsg, key) - case "registrationTimestamp": - err = unpopulateTimeRFC3339(val, "RegistrationTimestamp", &c.RegistrationTimestamp) - delete(rawMsg, key) - case "reportedProperties": - err = unpopulate(val, "ReportedProperties", &c.ReportedProperties) - delete(rawMsg, key) - case "serviceEndpoint": - err = unpopulate(val, "ServiceEndpoint", &c.ServiceEndpoint) + case "lastStatusChange": + err = unpopulateTimeRFC3339(val, "LastStatusChange", &g.LastStatusChange) delete(rawMsg, key) case "status": - err = unpopulate(val, "Status", &c.Status) + err = unpopulate(val, "Status", &g.Status) delete(rawMsg, key) - case "trialDaysRemaining": - err = unpopulate(val, "TrialDaysRemaining", &c.TrialDaysRemaining) + case "vmUuid": + err = unpopulate(val, "VMUUID", &g.VMUUID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClusterReportedProperties. -func (c ClusterReportedProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GuestAgentList. +func (g GuestAgentList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clusterId", c.ClusterID) - populate(objectMap, "clusterName", c.ClusterName) - populate(objectMap, "clusterVersion", c.ClusterVersion) - populate(objectMap, "diagnosticLevel", c.DiagnosticLevel) - populate(objectMap, "imdsAttestation", c.ImdsAttestation) - populateTimeRFC3339(objectMap, "lastUpdated", c.LastUpdated) - populate(objectMap, "nodes", c.Nodes) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterReportedProperties. -func (c *ClusterReportedProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentList. +func (g *GuestAgentList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "clusterId": - err = unpopulate(val, "ClusterID", &c.ClusterID) - delete(rawMsg, key) - case "clusterName": - err = unpopulate(val, "ClusterName", &c.ClusterName) + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) delete(rawMsg, key) - case "clusterVersion": - err = unpopulate(val, "ClusterVersion", &c.ClusterVersion) + case "value": + err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) - case "diagnosticLevel": - err = unpopulate(val, "DiagnosticLevel", &c.DiagnosticLevel) + } + 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, "provisioningAction", g.ProvisioningAction) + populate(objectMap, "provisioningState", g.ProvisioningState) + populate(objectMap, "status", g.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentProperties. +func (g *GuestAgentProperties) 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 "credentials": + err = unpopulate(val, "Credentials", &g.Credentials) delete(rawMsg, key) - case "imdsAttestation": - err = unpopulate(val, "ImdsAttestation", &c.ImdsAttestation) + case "provisioningAction": + err = unpopulate(val, "ProvisioningAction", &g.ProvisioningAction) delete(rawMsg, key) - case "lastUpdated": - err = unpopulateTimeRFC3339(val, "LastUpdated", &c.LastUpdated) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) delete(rawMsg, key) - case "nodes": - err = unpopulate(val, "Nodes", &c.Nodes) + case "status": + err = unpopulate(val, "Status", &g.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GuestCredential. +func (g GuestCredential) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) + populate(objectMap, "password", g.Password) + populate(objectMap, "username", g.Username) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. -func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GuestCredential. +func (g *GuestCredential) 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) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) + case "password": + err = unpopulate(val, "Password", &g.Password) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "username": + err = unpopulate(val, "Username", &g.Username) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HTTPProxyConfiguration. +func (h HTTPProxyConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) + populate(objectMap, "httpProxy", h.HTTPProxy) + populate(objectMap, "httpsProxy", h.HTTPSProxy) + populate(objectMap, "noProxy", h.NoProxy) + populate(objectMap, "trustedCa", h.TrustedCa) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPProxyConfiguration. +func (h *HTTPProxyConfiguration) 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) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + case "httpProxy": + err = unpopulate(val, "HTTPProxy", &h.HTTPProxy) delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) + case "httpsProxy": + err = unpopulate(val, "HTTPSProxy", &h.HTTPSProxy) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "noProxy": + err = unpopulate(val, "NoProxy", &h.NoProxy) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) + case "trustedCa": + err = unpopulate(val, "TrustedCa", &h.TrustedCa) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HardwareProfileUpdate. +func (h HardwareProfileUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populate(objectMap, "memoryMB", h.MemoryMB) + populate(objectMap, "processors", h.Processors) + populate(objectMap, "vmSize", h.VMSize) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HardwareProfileUpdate. +func (h *HardwareProfileUpdate) 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) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "memoryMB": + err = unpopulate(val, "MemoryMB", &h.MemoryMB) + delete(rawMsg, key) + case "processors": + err = unpopulate(val, "Processors", &h.Processors) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &h.VMSize) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Extension. -func (e Extension) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadata. +func (h HybridIdentityMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) + 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) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Extension. -func (e *Extension) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadata. +func (h *HybridIdentityMetadata) 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) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &e.ID) + err = unpopulate(val, "ID", &h.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &e.Name) + err = unpopulate(val, "Name", &h.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &e.Properties) + err = unpopulate(val, "Properties", &h.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) + err = unpopulate(val, "SystemData", &h.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &e.Type) + err = unpopulate(val, "Type", &h.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExtensionList. -func (e ExtensionList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataList. +func (h HybridIdentityMetadataList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionList. -func (e *ExtensionList) UnmarshalJSON(data []byte) error { +// 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", e, err) + 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", &e.NextLink) + err = unpopulate(val, "NextLink", &h.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &e.Value) + err = unpopulate(val, "Value", &h.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExtensionParameters. -func (e ExtensionParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataProperties. +func (h HybridIdentityMetadataProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "autoUpgradeMinorVersion", e.AutoUpgradeMinorVersion) - populate(objectMap, "forceUpdateTag", e.ForceUpdateTag) - populateAny(objectMap, "protectedSettings", e.ProtectedSettings) - populate(objectMap, "publisher", e.Publisher) - populateAny(objectMap, "settings", e.Settings) - populate(objectMap, "type", e.Type) - populate(objectMap, "typeHandlerVersion", e.TypeHandlerVersion) + populate(objectMap, "identity", h.Identity) + populate(objectMap, "provisioningState", h.ProvisioningState) + populate(objectMap, "publicKey", h.PublicKey) + populate(objectMap, "resourceUid", h.ResourceUID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionParameters. -func (e *ExtensionParameters) UnmarshalJSON(data []byte) error { +// 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", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { - case "autoUpgradeMinorVersion": - err = unpopulate(val, "AutoUpgradeMinorVersion", &e.AutoUpgradeMinorVersion) - delete(rawMsg, key) - case "forceUpdateTag": - err = unpopulate(val, "ForceUpdateTag", &e.ForceUpdateTag) - delete(rawMsg, key) - case "protectedSettings": - err = unpopulate(val, "ProtectedSettings", &e.ProtectedSettings) - delete(rawMsg, key) - case "publisher": - err = unpopulate(val, "Publisher", &e.Publisher) + case "identity": + err = unpopulate(val, "Identity", &h.Identity) delete(rawMsg, key) - case "settings": - err = unpopulate(val, "Settings", &e.Settings) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "publicKey": + err = unpopulate(val, "PublicKey", &h.PublicKey) delete(rawMsg, key) - case "typeHandlerVersion": - err = unpopulate(val, "TypeHandlerVersion", &e.TypeHandlerVersion) + case "resourceUid": + err = unpopulate(val, "ResourceUID", &h.ResourceUID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExtensionProperties. -func (e ExtensionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IPConfiguration. +func (i IPConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "aggregateState", e.AggregateState) - populate(objectMap, "extensionParameters", e.ExtensionParameters) - populate(objectMap, "perNodeExtensionDetails", e.PerNodeExtensionDetails) - populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionProperties. -func (e *ExtensionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfiguration. +func (i *IPConfiguration) 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) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "aggregateState": - err = unpopulate(val, "AggregateState", &e.AggregateState) - delete(rawMsg, key) - case "extensionParameters": - err = unpopulate(val, "ExtensionParameters", &e.ExtensionParameters) - delete(rawMsg, key) - case "perNodeExtensionDetails": - err = unpopulate(val, "PerNodeExtensionDetails", &e.PerNodeExtensionDetails) + case "name": + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IPConfigurationProperties. +func (i IPConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionType", o.ActionType) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) + populate(objectMap, "gateway", i.Gateway) + populate(objectMap, "prefixLength", i.PrefixLength) + populate(objectMap, "privateIPAddress", i.PrivateIPAddress) + populate(objectMap, "subnet", i.Subnet) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfigurationProperties. +func (i *IPConfigurationProperties) 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) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "actionType": - err = unpopulate(val, "ActionType", &o.ActionType) - delete(rawMsg, key) - case "display": - err = unpopulate(val, "Display", &o.Display) + case "gateway": + err = unpopulate(val, "Gateway", &i.Gateway) delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) + case "prefixLength": + err = unpopulate(val, "PrefixLength", &i.PrefixLength) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &i.PrivateIPAddress) delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) + case "subnet": + err = unpopulate(val, "Subnet", &i.Subnet) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IPConfigurationPropertiesSubnet. +func (i IPConfigurationPropertiesSubnet) 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) + populate(objectMap, "id", i.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfigurationPropertiesSubnet. +func (i *IPConfigurationPropertiesSubnet) 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) + return fmt.Errorf("unmarshalling type %T: %v", i, 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) + case "id": + err = unpopulate(val, "ID", &i.ID) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPPool. +func (i IPPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "end", i.End) + populate(objectMap, "ipPoolType", i.IPPoolType) + populate(objectMap, "info", i.Info) + populate(objectMap, "name", i.Name) + populate(objectMap, "start", i.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPPool. +func (i *IPPool) 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 "end": + err = unpopulate(val, "End", &i.End) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "ipPoolType": + err = unpopulate(val, "IPPoolType", &i.IPPoolType) + delete(rawMsg, key) + case "info": + err = unpopulate(val, "Info", &i.Info) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "start": + err = unpopulate(val, "Start", &i.Start) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IPPoolInfo. +func (i IPPoolInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "available", i.Available) + populate(objectMap, "used", i.Used) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IPPoolInfo. +func (i *IPPoolInfo) 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) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + case "available": + err = unpopulate(val, "Available", &i.Available) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + case "used": + err = unpopulate(val, "Used", &i.Used) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", i, 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) + objectMap["type"] = "SystemAssigned" + 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) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PasswordCredential. -func (p PasswordCredential) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InstanceViewStatus. +func (i InstanceViewStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "endDateTime", p.EndDateTime) - populate(objectMap, "keyId", p.KeyID) - populate(objectMap, "secretText", p.SecretText) - populateTimeRFC3339(objectMap, "startDateTime", p.StartDateTime) + populate(objectMap, "code", i.Code) + populate(objectMap, "displayStatus", i.DisplayStatus) + populate(objectMap, "level", i.Level) + populate(objectMap, "message", i.Message) + populateTimeRFC3339(objectMap, "time", i.Time) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PasswordCredential. -func (p *PasswordCredential) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InstanceViewStatus. +func (i *InstanceViewStatus) 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", i, err) } for key, val := range rawMsg { var err error switch key { - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &p.EndDateTime) + case "code": + err = unpopulate(val, "Code", &i.Code) + delete(rawMsg, key) + case "displayStatus": + err = unpopulate(val, "DisplayStatus", &i.DisplayStatus) delete(rawMsg, key) - case "keyId": - err = unpopulate(val, "KeyID", &p.KeyID) + case "level": + err = unpopulate(val, "Level", &i.Level) delete(rawMsg, key) - case "secretText": - err = unpopulate(val, "SecretText", &p.SecretText) + case "message": + err = unpopulate(val, "Message", &i.Message) delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &p.StartDateTime) + case "time": + err = unpopulateTimeRFC3339(val, "Time", &i.Time) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PerNodeExtensionState. -func (p PerNodeExtensionState) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InterfaceDNSSettings. +func (i InterfaceDNSSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "extension", p.Extension) - populate(objectMap, "name", p.Name) - populate(objectMap, "state", p.State) + populate(objectMap, "dnsServers", i.DNSServers) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PerNodeExtensionState. -func (p *PerNodeExtensionState) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceDNSSettings. +func (i *InterfaceDNSSettings) 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", i, err) } for key, val := range rawMsg { var err error switch key { - case "extension": - err = unpopulate(val, "Extension", &p.Extension) + case "dnsServers": + err = unpopulate(val, "DNSServers", &i.DNSServers) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogicalNetworkProperties. +func (l LogicalNetworkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dhcpOptions", l.DhcpOptions) + populate(objectMap, "provisioningState", l.ProvisioningState) + populate(objectMap, "status", l.Status) + populate(objectMap, "subnets", l.Subnets) + populate(objectMap, "vmSwitchName", l.VMSwitchName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkProperties. +func (l *LogicalNetworkProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dhcpOptions": + err = unpopulate(val, "DhcpOptions", &l.DhcpOptions) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &l.Status) + delete(rawMsg, key) + case "subnets": + err = unpopulate(val, "Subnets", &l.Subnets) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) + case "vmSwitchName": + err = unpopulate(val, "VMSwitchName", &l.VMSwitchName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PerNodeState. -func (p PerNodeState) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LogicalNetworkPropertiesDhcpOptions. +func (l LogicalNetworkPropertiesDhcpOptions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "arcInstance", p.ArcInstance) - populate(objectMap, "name", p.Name) - populate(objectMap, "state", p.State) + populate(objectMap, "dnsServers", l.DNSServers) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PerNodeState. -func (p *PerNodeState) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkPropertiesDhcpOptions. +func (l *LogicalNetworkPropertiesDhcpOptions) 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", l, err) } for key, val := range rawMsg { var err error switch key { - case "arcInstance": - err = unpopulate(val, "ArcInstance", &p.ArcInstance) + case "dnsServers": + err = unpopulate(val, "DNSServers", &l.DNSServers) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogicalNetworkStatus. +func (l LogicalNetworkStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorCode", l.ErrorCode) + populate(objectMap, "errorMessage", l.ErrorMessage) + populate(objectMap, "provisioningStatus", l.ProvisioningStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkStatus. +func (l *LogicalNetworkStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorCode": + err = unpopulate(val, "ErrorCode", &l.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &l.ErrorMessage) + delete(rawMsg, key) + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &l.ProvisioningStatus) + 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 LogicalNetworkStatusProvisioningStatus. +func (l LogicalNetworkStatusProvisioningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", l.OperationID) + populate(objectMap, "status", l.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkStatusProvisioningStatus. +func (l *LogicalNetworkStatusProvisioningStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operationId": + err = unpopulate(val, "OperationID", &l.OperationID) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) + case "status": + err = unpopulate(val, "Status", &l.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LogicalNetworks. +func (l LogicalNetworks) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) + populate(objectMap, "extendedLocation", l.ExtendedLocation) + populate(objectMap, "id", l.ID) + populate(objectMap, "location", l.Location) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "tags", l.Tags) + populate(objectMap, "type", l.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworks. +func (l *LogicalNetworks) 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", l, err) } for key, val := range rawMsg { var err error switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &l.ExtendedLocation) + delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &p.ID) + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &l.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &p.Type) + err = unpopulate(val, "Type", &l.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RawCertificateData. -func (r RawCertificateData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LogicalNetworksListResult. +func (l LogicalNetworksListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "certificates", r.Certificates) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RawCertificateData. -func (r *RawCertificateData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworksListResult. +func (l *LogicalNetworksListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "certificates": - err = unpopulate(val, "Certificates", &r.Certificates) + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LogicalNetworksUpdateRequest. +func (l LogicalNetworksUpdateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) + populate(objectMap, "tags", l.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworksUpdateRequest. +func (l *LogicalNetworksUpdateRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImageProperties. +func (m MarketplaceGalleryImageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cloudInitDataSource", m.CloudInitDataSource) + populate(objectMap, "containerId", m.ContainerID) + populate(objectMap, "hyperVGeneration", m.HyperVGeneration) + populate(objectMap, "identifier", m.Identifier) + populate(objectMap, "osType", m.OSType) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "status", m.Status) + populate(objectMap, "version", m.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageProperties. +func (m *MarketplaceGalleryImageProperties) 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 "cloudInitDataSource": + err = unpopulate(val, "CloudInitDataSource", &m.CloudInitDataSource) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "containerId": + err = unpopulate(val, "ContainerID", &m.ContainerID) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &m.HyperVGeneration) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, "Identifier", &m.Identifier) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &m.OSType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &m.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImageStatus. +func (m MarketplaceGalleryImageStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + populate(objectMap, "downloadStatus", m.DownloadStatus) + populate(objectMap, "errorCode", m.ErrorCode) + populate(objectMap, "errorMessage", m.ErrorMessage) + populate(objectMap, "progressPercentage", m.ProgressPercentage) + populate(objectMap, "provisioningStatus", m.ProvisioningStatus) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageStatus. +func (m *MarketplaceGalleryImageStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + case "downloadStatus": + err = unpopulate(val, "DownloadStatus", &m.DownloadStatus) delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) + case "errorCode": + err = unpopulate(val, "ErrorCode", &m.ErrorCode) delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &m.ErrorMessage) delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + case "progressPercentage": + err = unpopulate(val, "ProgressPercentage", &m.ProgressPercentage) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &m.ProvisioningStatus) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImageStatusDownloadStatus. +func (m MarketplaceGalleryImageStatusDownloadStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "downloadSizeInMB", m.DownloadSizeInMB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageStatusDownloadStatus. +func (m *MarketplaceGalleryImageStatusDownloadStatus) 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 "downloadSizeInMB": + err = unpopulate(val, "DownloadSizeInMB", &m.DownloadSizeInMB) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImageStatusProvisioningStatus. +func (m MarketplaceGalleryImageStatusProvisioningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", m.OperationID) + populate(objectMap, "status", m.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageStatusProvisioningStatus. +func (m *MarketplaceGalleryImageStatusProvisioningStatus) 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 "operationId": + err = unpopulate(val, "OperationID", &m.OperationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + 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 TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImages. +func (m MarketplaceGalleryImages) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) + populate(objectMap, "extendedLocation", m.ExtendedLocation) + 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 TrackedResource. -func (t *TrackedResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImages. +func (m *MarketplaceGalleryImages) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &m.ExtendedLocation) + delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &t.ID) + err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &t.Location) + err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &t.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", &t.Tags) + err = unpopulate(val, "Tags", &m.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &t.Type) + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UploadCertificateRequest. -func (u UploadCertificateRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImagesListResult. +func (m MarketplaceGalleryImagesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", u.Properties) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UploadCertificateRequest. -func (u *UploadCertificateRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImagesListResult. +func (m *MarketplaceGalleryImagesListResult) 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", u, err) + 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", &u.Properties) + 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 MarketplaceGalleryImagesUpdateRequest. +func (m MarketplaceGalleryImagesUpdateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImagesUpdateRequest. +func (m *MarketplaceGalleryImagesUpdateRequest) 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 "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 NetworkInterfaceProperties. +func (n NetworkInterfaceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsSettings", n.DNSSettings) + populate(objectMap, "ipConfigurations", n.IPConfigurations) + populate(objectMap, "macAddress", n.MacAddress) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "status", n.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceProperties. +func (n *NetworkInterfaceProperties) 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 "dnsSettings": + err = unpopulate(val, "DNSSettings", &n.DNSSettings) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &n.IPConfigurations) + delete(rawMsg, key) + case "macAddress": + err = unpopulate(val, "MacAddress", &n.MacAddress) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &n.Status) + 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 NetworkInterfaceStatus. +func (n NetworkInterfaceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorCode", n.ErrorCode) + populate(objectMap, "errorMessage", n.ErrorMessage) + populate(objectMap, "provisioningStatus", n.ProvisioningStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceStatus. +func (n *NetworkInterfaceStatus) 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 "errorCode": + err = unpopulate(val, "ErrorCode", &n.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &n.ErrorMessage) + delete(rawMsg, key) + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &n.ProvisioningStatus) + 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 NetworkInterfaceStatusProvisioningStatus. +func (n NetworkInterfaceStatusProvisioningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", n.OperationID) + populate(objectMap, "status", n.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceStatusProvisioningStatus. +func (n *NetworkInterfaceStatusProvisioningStatus) 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 "operationId": + err = unpopulate(val, "OperationID", &n.OperationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &n.Status) + 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 NetworkInterfaces. +func (n NetworkInterfaces) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", n.ExtendedLocation) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "tags", n.Tags) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaces. +func (n *NetworkInterfaces) 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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &n.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &n.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &n.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &n.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + 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 NetworkInterfacesListResult. +func (n NetworkInterfacesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfacesListResult. +func (n *NetworkInterfacesListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) + 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 NetworkInterfacesUpdateRequest. +func (n NetworkInterfacesUpdateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", n.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfacesUpdateRequest. +func (n *NetworkInterfacesUpdateRequest) 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 "tags": + err = unpopulate(val, "Tags", &n.Tags) + 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 NetworkProfileUpdate. +func (n NetworkProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "networkInterfaces", n.NetworkInterfaces) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfileUpdate. +func (n *NetworkProfileUpdate) 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 "networkInterfaces": + err = unpopulate(val, "NetworkInterfaces", &n.NetworkInterfaces) + 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 NetworkProfileUpdateNetworkInterfacesItem. +func (n NetworkProfileUpdateNetworkInterfacesItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", n.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfileUpdateNetworkInterfacesItem. +func (n *NetworkProfileUpdateNetworkInterfacesItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + 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 "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + 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 OperationListResult. +func (o OperationListResult) 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 OperationListResult. +func (o *OperationListResult) 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 OsProfileUpdate. +func (o OsProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "computerName", o.ComputerName) + 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 "computerName": + err = unpopulate(val, "ComputerName", &o.ComputerName) + delete(rawMsg, key) + case "linuxConfiguration": + err = unpopulate(val, "LinuxConfiguration", &o.LinuxConfiguration) + 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 OsProfileUpdateLinuxConfiguration. +func (o OsProfileUpdateLinuxConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisionVMAgent", o.ProvisionVMAgent) + populate(objectMap, "provisionVMConfigAgent", o.ProvisionVMConfigAgent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdateLinuxConfiguration. +func (o *OsProfileUpdateLinuxConfiguration) 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 "provisionVMAgent": + err = unpopulate(val, "ProvisionVMAgent", &o.ProvisionVMAgent) + delete(rawMsg, key) + case "provisionVMConfigAgent": + err = unpopulate(val, "ProvisionVMConfigAgent", &o.ProvisionVMConfigAgent) + 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 OsProfileUpdateWindowsConfiguration. +func (o OsProfileUpdateWindowsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisionVMAgent", o.ProvisionVMAgent) + populate(objectMap, "provisionVMConfigAgent", o.ProvisionVMConfigAgent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdateWindowsConfiguration. +func (o *OsProfileUpdateWindowsConfiguration) 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 "provisionVMAgent": + err = unpopulate(val, "ProvisionVMAgent", &o.ProvisionVMAgent) + delete(rawMsg, key) + case "provisionVMConfigAgent": + err = unpopulate(val, "ProvisionVMConfigAgent", &o.ProvisionVMConfigAgent) + 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 Route. +func (r Route) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Route. +func (r *Route) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutePropertiesFormat. +func (r RoutePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressPrefix", r.AddressPrefix) + populate(objectMap, "nextHopIpAddress", r.NextHopIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutePropertiesFormat. +func (r *RoutePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &r.AddressPrefix) + delete(rawMsg, key) + case "nextHopIpAddress": + err = unpopulate(val, "NextHopIPAddress", &r.NextHopIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteTable. +func (r RouteTable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteTable. +func (r *RouteTable) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteTablePropertiesFormat. +func (r RouteTablePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "routes", r.Routes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteTablePropertiesFormat. +func (r *RouteTablePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "routes": + err = unpopulate(val, "Routes", &r.Routes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSHConfiguration. +func (s SSHConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "publicKeys", s.PublicKeys) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHConfiguration. +func (s *SSHConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "publicKeys": + err = unpopulate(val, "PublicKeys", &s.PublicKeys) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSHPublicKey. +func (s SSHPublicKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyData", s.KeyData) + populate(objectMap, "path", s.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHPublicKey. +func (s *SSHPublicKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyData": + err = unpopulate(val, "KeyData", &s.KeyData) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &s.Path) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageContainerProperties. +func (s StorageContainerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "path", s.Path) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerProperties. +func (s *StorageContainerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "path": + err = unpopulate(val, "Path", &s.Path) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageContainerStatus. +func (s StorageContainerStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availableSizeMB", s.AvailableSizeMB) + populate(objectMap, "containerSizeMB", s.ContainerSizeMB) + populate(objectMap, "errorCode", s.ErrorCode) + populate(objectMap, "errorMessage", s.ErrorMessage) + populate(objectMap, "provisioningStatus", s.ProvisioningStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerStatus. +func (s *StorageContainerStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availableSizeMB": + err = unpopulate(val, "AvailableSizeMB", &s.AvailableSizeMB) + delete(rawMsg, key) + case "containerSizeMB": + err = unpopulate(val, "ContainerSizeMB", &s.ContainerSizeMB) + delete(rawMsg, key) + case "errorCode": + err = unpopulate(val, "ErrorCode", &s.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) + delete(rawMsg, key) + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &s.ProvisioningStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageContainerStatusProvisioningStatus. +func (s StorageContainerStatusProvisioningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", s.OperationID) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerStatusProvisioningStatus. +func (s *StorageContainerStatusProvisioningStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operationId": + err = unpopulate(val, "OperationID", &s.OperationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageContainers. +func (s StorageContainers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", s.ExtendedLocation) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainers. +func (s *StorageContainers) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &s.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageContainersListResult. +func (s StorageContainersListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainersListResult. +func (s *StorageContainersListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageContainersUpdateRequest. +func (s StorageContainersUpdateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainersUpdateRequest. +func (s *StorageContainersUpdateRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageProfileUpdate. +func (s StorageProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataDisks", s.DataDisks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfileUpdate. +func (s *StorageProfileUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataDisks": + err = unpopulate(val, "DataDisks", &s.DataDisks) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageProfileUpdateDataDisksItem. +func (s StorageProfileUpdateDataDisksItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfileUpdateDataDisksItem. +func (s *StorageProfileUpdateDataDisksItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Subnet. +func (s Subnet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Subnet. +func (s *Subnet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubnetPropertiesFormat. +func (s SubnetPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressPrefix", s.AddressPrefix) + populate(objectMap, "addressPrefixes", s.AddressPrefixes) + populate(objectMap, "ipAllocationMethod", s.IPAllocationMethod) + populate(objectMap, "ipConfigurationReferences", s.IPConfigurationReferences) + populate(objectMap, "ipPools", s.IPPools) + populate(objectMap, "routeTable", s.RouteTable) + populate(objectMap, "vlan", s.Vlan) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetPropertiesFormat. +func (s *SubnetPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &s.AddressPrefix) + delete(rawMsg, key) + case "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &s.AddressPrefixes) + delete(rawMsg, key) + case "ipAllocationMethod": + err = unpopulate(val, "IPAllocationMethod", &s.IPAllocationMethod) + delete(rawMsg, key) + case "ipConfigurationReferences": + err = unpopulate(val, "IPConfigurationReferences", &s.IPConfigurationReferences) + delete(rawMsg, key) + case "ipPools": + err = unpopulate(val, "IPPools", &s.IPPools) + delete(rawMsg, key) + case "routeTable": + err = unpopulate(val, "RouteTable", &s.RouteTable) + delete(rawMsg, key) + case "vlan": + err = unpopulate(val, "Vlan", &s.Vlan) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubnetPropertiesFormatIPConfigurationReferencesItem. +func (s SubnetPropertiesFormatIPConfigurationReferencesItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ID", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetPropertiesFormatIPConfigurationReferencesItem. +func (s *SubnetPropertiesFormatIPConfigurationReferencesItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ID": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHardDiskProperties. +func (v VirtualHardDiskProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blockSizeBytes", v.BlockSizeBytes) + populate(objectMap, "containerId", v.ContainerID) + populate(objectMap, "diskFileFormat", v.DiskFileFormat) + populate(objectMap, "diskSizeGB", v.DiskSizeGB) + populate(objectMap, "dynamic", v.Dynamic) + populate(objectMap, "hyperVGeneration", v.HyperVGeneration) + populate(objectMap, "logicalSectorBytes", v.LogicalSectorBytes) + populate(objectMap, "physicalSectorBytes", v.PhysicalSectorBytes) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "status", v.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHardDiskProperties. +func (v *VirtualHardDiskProperties) 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 "blockSizeBytes": + err = unpopulate(val, "BlockSizeBytes", &v.BlockSizeBytes) + delete(rawMsg, key) + case "containerId": + err = unpopulate(val, "ContainerID", &v.ContainerID) + delete(rawMsg, key) + case "diskFileFormat": + err = unpopulate(val, "DiskFileFormat", &v.DiskFileFormat) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &v.DiskSizeGB) + delete(rawMsg, key) + case "dynamic": + err = unpopulate(val, "Dynamic", &v.Dynamic) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &v.HyperVGeneration) + delete(rawMsg, key) + case "logicalSectorBytes": + err = unpopulate(val, "LogicalSectorBytes", &v.LogicalSectorBytes) + delete(rawMsg, key) + case "physicalSectorBytes": + err = unpopulate(val, "PhysicalSectorBytes", &v.PhysicalSectorBytes) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) + 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 VirtualHardDiskStatus. +func (v VirtualHardDiskStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorCode", v.ErrorCode) + populate(objectMap, "errorMessage", v.ErrorMessage) + populate(objectMap, "provisioningStatus", v.ProvisioningStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHardDiskStatus. +func (v *VirtualHardDiskStatus) 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 "errorCode": + err = unpopulate(val, "ErrorCode", &v.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &v.ErrorMessage) + delete(rawMsg, key) + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &v.ProvisioningStatus) + 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 VirtualHardDiskStatusProvisioningStatus. +func (v VirtualHardDiskStatusProvisioningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", v.OperationID) + populate(objectMap, "status", v.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHardDiskStatusProvisioningStatus. +func (v *VirtualHardDiskStatusProvisioningStatus) 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 "operationId": + err = unpopulate(val, "OperationID", &v.OperationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) + 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 VirtualHardDisks. +func (v VirtualHardDisks) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", v.ExtendedLocation) + populate(objectMap, "id", v.ID) + 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 VirtualHardDisks. +func (v *VirtualHardDisks) 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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &v.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + 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) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHardDisksListResult. +func (v VirtualHardDisksListResult) 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 VirtualHardDisksListResult. +func (v *VirtualHardDisksListResult) 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 VirtualHardDisksUpdateRequest. +func (v VirtualHardDisksUpdateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", v.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHardDisksUpdateRequest. +func (v *VirtualHardDisksUpdateRequest) 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 "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 VirtualMachineConfigAgentInstanceView. +func (v VirtualMachineConfigAgentInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "statuses", v.Statuses) + populate(objectMap, "vmConfigAgentVersion", v.VMConfigAgentVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineConfigAgentInstanceView. +func (v *VirtualMachineConfigAgentInstanceView) 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 "statuses": + err = unpopulate(val, "Statuses", &v.Statuses) + delete(rawMsg, key) + case "vmConfigAgentVersion": + err = unpopulate(val, "VMConfigAgentVersion", &v.VMConfigAgentVersion) + 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 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, "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 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &v.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + 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 VirtualMachineInstanceListResult. +func (v VirtualMachineInstanceListResult) 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 VirtualMachineInstanceListResult. +func (v *VirtualMachineInstanceListResult) 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 VirtualMachineInstanceProperties. +func (v VirtualMachineInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "guestAgentInstallStatus", v.GuestAgentInstallStatus) + populate(objectMap, "httpProxyConfig", v.HTTPProxyConfig) + populate(objectMap, "hardwareProfile", v.HardwareProfile) + populate(objectMap, "instanceView", v.InstanceView) + populate(objectMap, "networkProfile", v.NetworkProfile) + populate(objectMap, "osProfile", v.OSProfile) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "resourceUid", v.ResourceUID) + populate(objectMap, "securityProfile", v.SecurityProfile) + populate(objectMap, "status", v.Status) + populate(objectMap, "storageProfile", v.StorageProfile) + populate(objectMap, "vmId", v.VMID) + return json.Marshal(objectMap) +} + +// 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "guestAgentInstallStatus": + err = unpopulate(val, "GuestAgentInstallStatus", &v.GuestAgentInstallStatus) + delete(rawMsg, key) + case "httpProxyConfig": + err = unpopulate(val, "HTTPProxyConfig", &v.HTTPProxyConfig) + delete(rawMsg, key) + case "hardwareProfile": + err = unpopulate(val, "HardwareProfile", &v.HardwareProfile) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &v.InstanceView) + 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 "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "resourceUid": + err = unpopulate(val, "ResourceUID", &v.ResourceUID) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &v.SecurityProfile) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &v.StorageProfile) + 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 VirtualMachineInstancePropertiesHardwareProfile. +func (v VirtualMachineInstancePropertiesHardwareProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dynamicMemoryConfig", v.DynamicMemoryConfig) + populate(objectMap, "memoryMB", v.MemoryMB) + populate(objectMap, "processors", v.Processors) + populate(objectMap, "vmSize", v.VMSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancePropertiesHardwareProfile. +func (v *VirtualMachineInstancePropertiesHardwareProfile) 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 "dynamicMemoryConfig": + err = unpopulate(val, "DynamicMemoryConfig", &v.DynamicMemoryConfig) + delete(rawMsg, key) + case "memoryMB": + err = unpopulate(val, "MemoryMB", &v.MemoryMB) + delete(rawMsg, key) + case "processors": + err = unpopulate(val, "Processors", &v.Processors) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &v.VMSize) + 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 VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig. +func (v VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maximumMemoryMB", v.MaximumMemoryMB) + populate(objectMap, "minimumMemoryMB", v.MinimumMemoryMB) + populate(objectMap, "targetMemoryBuffer", v.TargetMemoryBuffer) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig. +func (v *VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig) 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 "maximumMemoryMB": + err = unpopulate(val, "MaximumMemoryMB", &v.MaximumMemoryMB) + delete(rawMsg, key) + case "minimumMemoryMB": + err = unpopulate(val, "MinimumMemoryMB", &v.MinimumMemoryMB) + delete(rawMsg, key) + case "targetMemoryBuffer": + err = unpopulate(val, "TargetMemoryBuffer", &v.TargetMemoryBuffer) + 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 VirtualMachineInstancePropertiesNetworkProfile. +func (v VirtualMachineInstancePropertiesNetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "networkInterfaces", v.NetworkInterfaces) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancePropertiesNetworkProfile. +func (v *VirtualMachineInstancePropertiesNetworkProfile) 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 "networkInterfaces": + err = unpopulate(val, "NetworkInterfaces", &v.NetworkInterfaces) + 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 VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem. +func (v VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem. +func (v *VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstancePropertiesOsProfile. +func (v VirtualMachineInstancePropertiesOsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adminPassword", v.AdminPassword) + populate(objectMap, "adminUsername", v.AdminUsername) + populate(objectMap, "computerName", v.ComputerName) + populate(objectMap, "linuxConfiguration", v.LinuxConfiguration) + populate(objectMap, "windowsConfiguration", v.WindowsConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancePropertiesOsProfile. +func (v *VirtualMachineInstancePropertiesOsProfile) 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 "adminPassword": + err = unpopulate(val, "AdminPassword", &v.AdminPassword) + delete(rawMsg, key) + case "adminUsername": + err = unpopulate(val, "AdminUsername", &v.AdminUsername) + delete(rawMsg, key) + case "computerName": + err = unpopulate(val, "ComputerName", &v.ComputerName) + delete(rawMsg, key) + case "linuxConfiguration": + err = unpopulate(val, "LinuxConfiguration", &v.LinuxConfiguration) + delete(rawMsg, key) + case "windowsConfiguration": + err = unpopulate(val, "WindowsConfiguration", &v.WindowsConfiguration) + 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 VirtualMachineInstancePropertiesOsProfileLinuxConfiguration. +func (v VirtualMachineInstancePropertiesOsProfileLinuxConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "disablePasswordAuthentication", v.DisablePasswordAuthentication) + populate(objectMap, "provisionVMAgent", v.ProvisionVMAgent) + populate(objectMap, "provisionVMConfigAgent", v.ProvisionVMConfigAgent) + populate(objectMap, "ssh", v.SSH) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancePropertiesOsProfileLinuxConfiguration. +func (v *VirtualMachineInstancePropertiesOsProfileLinuxConfiguration) 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 "disablePasswordAuthentication": + err = unpopulate(val, "DisablePasswordAuthentication", &v.DisablePasswordAuthentication) + delete(rawMsg, key) + case "provisionVMAgent": + err = unpopulate(val, "ProvisionVMAgent", &v.ProvisionVMAgent) + delete(rawMsg, key) + case "provisionVMConfigAgent": + err = unpopulate(val, "ProvisionVMConfigAgent", &v.ProvisionVMConfigAgent) + delete(rawMsg, key) + case "ssh": + err = unpopulate(val, "SSH", &v.SSH) + 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 VirtualMachineInstancePropertiesOsProfileWindowsConfiguration. +func (v VirtualMachineInstancePropertiesOsProfileWindowsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enableAutomaticUpdates", v.EnableAutomaticUpdates) + populate(objectMap, "provisionVMAgent", v.ProvisionVMAgent) + populate(objectMap, "provisionVMConfigAgent", v.ProvisionVMConfigAgent) + populate(objectMap, "ssh", v.SSH) + populate(objectMap, "timeZone", v.TimeZone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancePropertiesOsProfileWindowsConfiguration. +func (v *VirtualMachineInstancePropertiesOsProfileWindowsConfiguration) 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 "enableAutomaticUpdates": + err = unpopulate(val, "EnableAutomaticUpdates", &v.EnableAutomaticUpdates) + delete(rawMsg, key) + case "provisionVMAgent": + err = unpopulate(val, "ProvisionVMAgent", &v.ProvisionVMAgent) + delete(rawMsg, key) + case "provisionVMConfigAgent": + err = unpopulate(val, "ProvisionVMConfigAgent", &v.ProvisionVMConfigAgent) + delete(rawMsg, key) + case "ssh": + err = unpopulate(val, "SSH", &v.SSH) + delete(rawMsg, key) + case "timeZone": + err = unpopulate(val, "TimeZone", &v.TimeZone) + 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 VirtualMachineInstancePropertiesSecurityProfile. +func (v VirtualMachineInstancePropertiesSecurityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enableTPM", v.EnableTPM) + populate(objectMap, "securityType", v.SecurityType) + populate(objectMap, "uefiSettings", v.UefiSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancePropertiesSecurityProfile. +func (v *VirtualMachineInstancePropertiesSecurityProfile) 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 "enableTPM": + err = unpopulate(val, "EnableTPM", &v.EnableTPM) + delete(rawMsg, key) + case "securityType": + err = unpopulate(val, "SecurityType", &v.SecurityType) + delete(rawMsg, key) + case "uefiSettings": + err = unpopulate(val, "UefiSettings", &v.UefiSettings) + 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 VirtualMachineInstancePropertiesSecurityProfileUefiSettings. +func (v VirtualMachineInstancePropertiesSecurityProfileUefiSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "secureBootEnabled", v.SecureBootEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancePropertiesSecurityProfileUefiSettings. +func (v *VirtualMachineInstancePropertiesSecurityProfileUefiSettings) 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 "secureBootEnabled": + err = unpopulate(val, "SecureBootEnabled", &v.SecureBootEnabled) + 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 VirtualMachineInstancePropertiesStorageProfile. +func (v VirtualMachineInstancePropertiesStorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataDisks", v.DataDisks) + populate(objectMap, "imageReference", v.ImageReference) + populate(objectMap, "osDisk", v.OSDisk) + populate(objectMap, "vmConfigStoragePathId", v.VMConfigStoragePathID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancePropertiesStorageProfile. +func (v *VirtualMachineInstancePropertiesStorageProfile) 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 "dataDisks": + err = unpopulate(val, "DataDisks", &v.DataDisks) + delete(rawMsg, key) + case "imageReference": + err = unpopulate(val, "ImageReference", &v.ImageReference) + delete(rawMsg, key) + case "osDisk": + err = unpopulate(val, "OSDisk", &v.OSDisk) + delete(rawMsg, key) + case "vmConfigStoragePathId": + err = unpopulate(val, "VMConfigStoragePathID", &v.VMConfigStoragePathID) + 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 VirtualMachineInstancePropertiesStorageProfileDataDisksItem. +func (v VirtualMachineInstancePropertiesStorageProfileDataDisksItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancePropertiesStorageProfileDataDisksItem. +func (v *VirtualMachineInstancePropertiesStorageProfileDataDisksItem) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstancePropertiesStorageProfileImageReference. +func (v VirtualMachineInstancePropertiesStorageProfileImageReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancePropertiesStorageProfileImageReference. +func (v *VirtualMachineInstancePropertiesStorageProfileImageReference) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstancePropertiesStorageProfileOsDisk. +func (v VirtualMachineInstancePropertiesStorageProfileOsDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "osType", v.OSType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstancePropertiesStorageProfileOsDisk. +func (v *VirtualMachineInstancePropertiesStorageProfileOsDisk) 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 "osType": + err = unpopulate(val, "OSType", &v.OSType) + 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 VirtualMachineInstanceStatus. +func (v VirtualMachineInstanceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorCode", v.ErrorCode) + populate(objectMap, "errorMessage", v.ErrorMessage) + populate(objectMap, "powerState", v.PowerState) + populate(objectMap, "provisioningStatus", v.ProvisioningStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstanceStatus. +func (v *VirtualMachineInstanceStatus) 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 "errorCode": + err = unpopulate(val, "ErrorCode", &v.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &v.ErrorMessage) + delete(rawMsg, key) + case "powerState": + err = unpopulate(val, "PowerState", &v.PowerState) + delete(rawMsg, key) + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &v.ProvisioningStatus) + 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 VirtualMachineInstanceStatusProvisioningStatus. +func (v VirtualMachineInstanceStatusProvisioningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", v.OperationID) + populate(objectMap, "status", v.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstanceStatusProvisioningStatus. +func (v *VirtualMachineInstanceStatusProvisioningStatus) 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 "operationId": + err = unpopulate(val, "OperationID", &v.OperationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) + 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 VirtualMachineInstanceUpdateProperties. +func (v VirtualMachineInstanceUpdateProperties) 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 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 "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 VirtualMachineInstanceUpdateRequest. +func (v VirtualMachineInstanceUpdateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", v.Identity) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstanceUpdateRequest. +func (v *VirtualMachineInstanceUpdateRequest) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstanceView. +func (v VirtualMachineInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "vmAgent", v.VMAgent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstanceView. +func (v *VirtualMachineInstanceView) 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 "vmAgent": + err = unpopulate(val, "VMAgent", &v.VMAgent) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client.go new file mode 100644 index 000000000000..4b503a241214 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client.go @@ -0,0 +1,449 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurestackhci + +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" +) + +// NetworkInterfacesClient contains the methods for the NetworkInterfaces group. +// Don't use this type directly, use NewNetworkInterfacesClient() instead. +type NetworkInterfacesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewNetworkInterfacesClient creates a new instance of NetworkInterfacesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewNetworkInterfacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NetworkInterfacesClient, error) { + cl, err := arm.NewClient(moduleName+".NetworkInterfacesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &NetworkInterfacesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a network interface. Please note some properties can be set only +// during network interface creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - networkInterfaceName - Name of the network interface +// - options - NetworkInterfacesClientBeginCreateOrUpdateOptions contains the optional parameters for the NetworkInterfacesClient.BeginCreateOrUpdate +// method. +func (client *NetworkInterfacesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, networkInterfaces NetworkInterfaces, options *NetworkInterfacesClientBeginCreateOrUpdateOptions) (*runtime.Poller[NetworkInterfacesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkInterfaceName, networkInterfaces, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NetworkInterfacesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[NetworkInterfacesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - The operation to create or update a network interface. Please note some properties can be set only during +// network interface creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *NetworkInterfacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, networkInterfaces NetworkInterfaces, options *NetworkInterfacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkInterfaceName, networkInterfaces, 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 *NetworkInterfacesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, networkInterfaces NetworkInterfaces, options *NetworkInterfacesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" + 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 networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, networkInterfaces); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete a network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - networkInterfaceName - Name of the network interface +// - options - NetworkInterfacesClientBeginDeleteOptions contains the optional parameters for the NetworkInterfacesClient.BeginDelete +// method. +func (client *NetworkInterfacesClient) BeginDelete(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *NetworkInterfacesClientBeginDeleteOptions) (*runtime.Poller[NetworkInterfacesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkInterfaceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NetworkInterfacesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[NetworkInterfacesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - The operation to delete a network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *NetworkInterfacesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *NetworkInterfacesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkInterfaceName, 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 *NetworkInterfacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *NetworkInterfacesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" + 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 networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a network interface +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - networkInterfaceName - Name of the network interface +// - options - NetworkInterfacesClientGetOptions contains the optional parameters for the NetworkInterfacesClient.Get method. +func (client *NetworkInterfacesClient) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *NetworkInterfacesClientGetOptions) (NetworkInterfacesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) + if err != nil { + return NetworkInterfacesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkInterfacesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NetworkInterfacesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *NetworkInterfacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *NetworkInterfacesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" + 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 networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NetworkInterfacesClient) getHandleResponse(resp *http.Response) (NetworkInterfacesClientGetResponse, error) { + result := NetworkInterfacesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaces); err != nil { + return NetworkInterfacesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response +// to get the next page of network interfaces. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - NetworkInterfacesClientListOptions contains the optional parameters for the NetworkInterfacesClient.NewListPager +// method. +func (client *NetworkInterfacesClient) NewListPager(resourceGroupName string, options *NetworkInterfacesClientListOptions) *runtime.Pager[NetworkInterfacesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[NetworkInterfacesClientListResponse]{ + More: func(page NetworkInterfacesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NetworkInterfacesClientListResponse) (NetworkInterfacesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return NetworkInterfacesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkInterfacesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetworkInterfacesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *NetworkInterfacesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *NetworkInterfacesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces" + 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", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *NetworkInterfacesClient) listHandleResponse(resp *http.Response) (NetworkInterfacesClientListResponse, error) { + result := NetworkInterfacesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfacesListResult); err != nil { + return NetworkInterfacesClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response +// to get the next page of network interfaces. +// +// Generated from API version 2023-09-01-preview +// - options - NetworkInterfacesClientListAllOptions contains the optional parameters for the NetworkInterfacesClient.NewListAllPager +// method. +func (client *NetworkInterfacesClient) NewListAllPager(options *NetworkInterfacesClientListAllOptions) *runtime.Pager[NetworkInterfacesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[NetworkInterfacesClientListAllResponse]{ + More: func(page NetworkInterfacesClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NetworkInterfacesClientListAllResponse) (NetworkInterfacesClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return NetworkInterfacesClientListAllResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkInterfacesClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetworkInterfacesClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *NetworkInterfacesClient) listAllCreateRequest(ctx context.Context, options *NetworkInterfacesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkInterfaces" + 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", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *NetworkInterfacesClient) listAllHandleResponse(resp *http.Response) (NetworkInterfacesClientListAllResponse, error) { + result := NetworkInterfacesClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfacesListResult); err != nil { + return NetworkInterfacesClientListAllResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update a network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - networkInterfaceName - Name of the network interface +// - options - NetworkInterfacesClientBeginUpdateOptions contains the optional parameters for the NetworkInterfacesClient.BeginUpdate +// method. +func (client *NetworkInterfacesClient) BeginUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, networkInterfaces NetworkInterfacesUpdateRequest, options *NetworkInterfacesClientBeginUpdateOptions) (*runtime.Poller[NetworkInterfacesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, networkInterfaceName, networkInterfaces, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NetworkInterfacesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[NetworkInterfacesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - The operation to update a network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *NetworkInterfacesClient) update(ctx context.Context, resourceGroupName string, networkInterfaceName string, networkInterfaces NetworkInterfacesUpdateRequest, options *NetworkInterfacesClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, networkInterfaceName, networkInterfaces, 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 *NetworkInterfacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, networkInterfaces NetworkInterfacesUpdateRequest, options *NetworkInterfacesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" + 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 networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, networkInterfaces); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client_example_test.go new file mode 100644 index 000000000000..e22143d50040 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client_example_test.go @@ -0,0 +1,295 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armazurestackhci_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/azurestackhci/armazurestackhci/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetNetworkInterface.json +func ExampleNetworkInterfacesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewNetworkInterfacesClient().Get(ctx, "test-rg", "test-nic", 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.NetworkInterfaces = armazurestackhci.NetworkInterfaces{ + // Name: to.Ptr("test-nic"), + // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.NetworkInterfaceProperties{ + // IPConfigurations: []*armazurestackhci.IPConfiguration{ + // { + // Name: to.Ptr("ipconfig-sample"), + // Properties: &armazurestackhci.IPConfigurationProperties{ + // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ + // ID: to.Ptr("external"), + // }, + // }, + // }}, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutNetworkInterface.json +func ExampleNetworkInterfacesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewNetworkInterfacesClient().BeginCreateOrUpdate(ctx, "test-rg", "test-nic", armazurestackhci.NetworkInterfaces{ + Location: to.Ptr("West US2"), + ExtendedLocation: &armazurestackhci.ExtendedLocation{ + Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + }, + Properties: &armazurestackhci.NetworkInterfaceProperties{ + IPConfigurations: []*armazurestackhci.IPConfiguration{ + { + Name: to.Ptr("ipconfig-sample"), + Properties: &armazurestackhci.IPConfigurationProperties{ + Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ + ID: to.Ptr("test-lnet"), + }, + }, + }}, + }, + }, 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.NetworkInterfaces = armazurestackhci.NetworkInterfaces{ + // Name: to.Ptr("test-nic"), + // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.NetworkInterfaceProperties{ + // IPConfigurations: []*armazurestackhci.IPConfiguration{ + // { + // Name: to.Ptr("ipconfig-sample"), + // Properties: &armazurestackhci.IPConfigurationProperties{ + // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ + // ID: to.Ptr("test-lnet"), + // }, + // }, + // }}, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteNetworkInterface.json +func ExampleNetworkInterfacesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewNetworkInterfacesClient().BeginDelete(ctx, "test-rg", "test-nic", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateNetworkInterface.json +func ExampleNetworkInterfacesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewNetworkInterfacesClient().BeginUpdate(ctx, "test-rg", "test-nic", armazurestackhci.NetworkInterfacesUpdateRequest{ + Tags: map[string]*string{ + "additionalProperties": to.Ptr("sample"), + }, + }, 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.NetworkInterfaces = armazurestackhci.NetworkInterfaces{ + // Name: to.Ptr("test-nic"), + // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.NetworkInterfaceProperties{ + // IPConfigurations: []*armazurestackhci.IPConfiguration{ + // { + // Name: to.Ptr("ipconfig-sample"), + // Properties: &armazurestackhci.IPConfigurationProperties{ + // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ + // ID: to.Ptr("test-lnet"), + // }, + // }, + // }}, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListNetworkInterfaceByResourceGroup.json +func ExampleNetworkInterfacesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewNetworkInterfacesClient().NewListPager("test-rg", 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.NetworkInterfacesListResult = armazurestackhci.NetworkInterfacesListResult{ + // Value: []*armazurestackhci.NetworkInterfaces{ + // { + // Name: to.Ptr("test-nic"), + // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.NetworkInterfaceProperties{ + // IPConfigurations: []*armazurestackhci.IPConfiguration{ + // { + // Name: to.Ptr("ipconfig-sample"), + // Properties: &armazurestackhci.IPConfigurationProperties{ + // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ + // ID: to.Ptr("external"), + // }, + // }, + // }}, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListNetworkInterfaceBySubscription.json +func ExampleNetworkInterfacesClient_NewListAllPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewNetworkInterfacesClient().NewListAllPager(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.NetworkInterfacesListResult = armazurestackhci.NetworkInterfacesListResult{ + // Value: []*armazurestackhci.NetworkInterfaces{ + // { + // Name: to.Ptr("test-nic"), + // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.NetworkInterfaceProperties{ + // IPConfigurations: []*armazurestackhci.IPConfiguration{ + // { + // Name: to.Ptr("ipconfig-sample"), + // Properties: &armazurestackhci.IPConfigurationProperties{ + // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ + // ID: to.Ptr("external"), + // }, + // }, + // }}, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go index a5031296580c..da1d3058af6c 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armazurestackhci @@ -38,24 +37,36 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// List - List all available Microsoft.AzureStackHCI provider operations -// If the operation fails it returns an *azcore.ResponseError type. +// NewListPager - List all the supported operations. // -// Generated from API version 2022-05-01 -// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(ctx context.Context, options *OperationsClientListOptions) (OperationsClientListResponse, error) { - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return OperationsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return OperationsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) +// Generated from API version 2023-09-01-preview +// - 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]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) } // listCreateRequest creates the List request. @@ -66,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client_example_test.go index 597dadc8d108..a29fb22b8856 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client_example_test.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client_example_test.go @@ -14,11 +14,11 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/ListOperations.json -func ExampleOperationsClient_List() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListOperations.json +func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -28,354 +28,30 @@ func ExampleOperationsClient_List() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewOperationsClient().List(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %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.OperationListResult = armazurestackhci.OperationListResult{ + // Value: []*armazurestackhci.Operation{ + // { + // Name: to.Ptr("Microsoft.AzureStackHCI/galleryImages/read"), + // Display: &armazurestackhci.OperationDisplay{ + // Description: to.Ptr("List or get the Addresses"), + // Operation: to.Ptr("List or Get Addresses"), + // Provider: to.Ptr("Azure Stack HCI"), + // Resource: to.Ptr("GalleryImages"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armazurestackhci.OriginUser), + // }}, + // } } - // 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.OperationListResult = armazurestackhci.OperationListResult{ - // Value: []*armazurestackhci.Operation{ - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/Register/Action"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Registers the subscription for the Azure Stack HCI resource provider and enables the creation of Azure Stack HCI resources."), - // Operation: to.Ptr("Registers the Azure Stack HCI Resource Provider"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("Register"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/Unregister/Action"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Unregisters the subscription for the Azure Stack HCI resource provider."), - // Operation: to.Ptr("Unregisters the Azure Stack HCI Resource Provider"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("Unregister"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/Operations/Read"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Gets operations"), - // Operation: to.Ptr("Gets/List operations resources"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("Operations"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/Clusters/Read"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Gets clusters"), - // Operation: to.Ptr("Gets/List cluster resources"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("Clusters"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/Clusters/Write"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Creates or updates a cluster"), - // Operation: to.Ptr("Create/update cluster resources"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("Clusters"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/Clusters/Delete"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Deletes cluster resource"), - // Operation: to.Ptr("Deletes cluster resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("Clusters"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/Clusters/ArcSettings/Read"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Gets arc resource of HCI cluster"), - // Operation: to.Ptr("Gets/List arc resources"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("Clusters/ArcSettings"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/Clusters/ArcSettings/Write"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Create or updates arc resource of HCI cluster"), - // Operation: to.Ptr("Create/Update arc resources"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("Clusters/ArcSettings"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/Clusters/ArcSettings/Delete"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Delete arc resource of HCI cluster"), - // Operation: to.Ptr("Delete arc resources"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("Clusters/ArcSettings"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/Clusters/ArcSettings/Extensions/Read"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Gets extension resource of HCI cluster"), - // Operation: to.Ptr("Gets/List extension resources of HCI cluster"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("Clusters/ArcSettings/Extensions"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/Clusters/ArcSettings/Extensions/Write"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Create or update extension resource of HCI cluster"), - // Operation: to.Ptr("Create/Update extension resources of HCI cluster"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("Clusters/ArcSettings/Extensions"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/Clusters/ArcSettings/Extensions/Delete"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Delete extension resources of HCI cluster"), - // Operation: to.Ptr("Delete extension resources of HCI cluster"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("Clusters/ArcSettings/Extensions"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualMachines/Restart/Action"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Restarts virtual machine resource"), - // Operation: to.Ptr("Restarts virtual machine resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualMachines"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualMachines/Start/Action"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Starts virtual machine resource"), - // Operation: to.Ptr("Starts virtual machine resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualMachines"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualMachines/Stop/Action"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Stops virtual machine resource"), - // Operation: to.Ptr("Stops virtual machine resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualMachines"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualMachines/Delete"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Deletes virtual machine resource"), - // Operation: to.Ptr("Deletes virtual machine resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualMachines"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualMachines/Write"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Creates/Updates virtual machine resource"), - // Operation: to.Ptr("Creates/Updates virtual machine resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualMachines"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualMachines/Read"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Gets/Lists virtual machine resource"), - // Operation: to.Ptr("Gets/Lists virtual machine resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualMachines"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualNetworks/Delete"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Deletes virtual networks resource"), - // Operation: to.Ptr("Deletes virtual networks resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualNetworks"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualNetworks/Write"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Creates/Updates virtual networks resource"), - // Operation: to.Ptr("Creates/Updates virtual networks resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualNetworks"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualNetworks/Read"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Gets/Lists virtual networks resource"), - // Operation: to.Ptr("Gets/Lists virtual networks resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualNetworks"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualHardDisks/Delete"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Deletes virtual hard disk resource"), - // Operation: to.Ptr("Deletes virtual hard disk resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualHardDisks"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualHardDisks/Write"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Creates/Updates virtual hard disk resource"), - // Operation: to.Ptr("Creates/Updates virtual hard disk resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualHardDisks"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualHardDisks/Read"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Gets/Lists virtual hard disk resource"), - // Operation: to.Ptr("Gets/Lists virtual hard disk resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualHardDisks"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/NetworkInterfaces/Delete"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Deletes network interfaces resource"), - // Operation: to.Ptr("Deletes network interfaces resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("NetworkInterfaces"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/NetworkInterfaces/Write"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Creates/Updates network interfaces resource"), - // Operation: to.Ptr("Creates/Updates network interfaces resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("NetworkInterfaces"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/NetworkInterfaces/Read"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Gets/Lists network interfaces resource"), - // Operation: to.Ptr("Gets/Lists network interfaces resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("NetworkInterfaces"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/GalleryImages/Delete"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Deletes gallery images resource"), - // Operation: to.Ptr("Deletes gallery images resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("GalleryImages"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/GalleryImages/Write"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Creates/Updates gallery images resource"), - // Operation: to.Ptr("Creates/Updates gallery images resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("GalleryImages"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/GalleryImages/Read"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Gets/Lists gallery images resource"), - // Operation: to.Ptr("Gets/Lists gallery images resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("GalleryImages"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualMachines/HybridIdentityMetadata/Read"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Gets/Lists virtual machine hybrid identity metadata proxy resource"), - // Operation: to.Ptr("Gets/Lists virtual machine hybrid identity metadata proxy resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualMachines/HybridIdentityMetadata"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualMachines/Extensions/Read"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Gets/Lists virtual machine extensions resource"), - // Operation: to.Ptr("Gets/Lists virtual machine extensions resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualMachines/Extensions"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualMachines/Extensions/Write"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Creates/Updates virtual machine extensions resource"), - // Operation: to.Ptr("Creates/Updates virtual machine extensions resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualMachines/Extensions"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/VirtualMachines/Extensions/Delete"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("Deletes virtual machine extensions resource"), - // Operation: to.Ptr("Deletes virtual machine extensions resource"), - // Provider: to.Ptr("Microsoft.AzureStackHCI"), - // Resource: to.Ptr("VirtualMachines/Extensions"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } } diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/options.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/options.go new file mode 100644 index 000000000000..68d5c353c92a --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/options.go @@ -0,0 +1,317 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurestackhci + +// GalleryImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginCreateOrUpdate +// method. +type GalleryImagesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryImagesClientBeginDeleteOptions contains the optional parameters for the GalleryImagesClient.BeginDelete method. +type GalleryImagesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryImagesClientBeginUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginUpdate method. +type GalleryImagesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryImagesClientGetOptions contains the optional parameters for the GalleryImagesClient.Get method. +type GalleryImagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// GalleryImagesClientListAllOptions contains the optional parameters for the GalleryImagesClient.NewListAllPager method. +type GalleryImagesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// GalleryImagesClientListOptions contains the optional parameters for the GalleryImagesClient.NewListPager method. +type GalleryImagesClientListOptions struct { + // placeholder for future optional parameters +} + +// GuestAgentClientBeginCreateOptions contains the optional parameters for the GuestAgentClient.BeginCreate method. +type GuestAgentClientBeginCreateOptions struct { + // Request payload. + Body *GuestAgent + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GuestAgentClientBeginDeleteOptions contains the optional parameters for the GuestAgentClient.BeginDelete method. +type GuestAgentClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GuestAgentClientGetOptions contains the optional parameters for the GuestAgentClient.Get method. +type GuestAgentClientGetOptions struct { + // placeholder for future optional parameters +} + +// GuestAgentsClientListOptions contains the optional parameters for the GuestAgentsClient.NewListPager method. +type GuestAgentsClientListOptions struct { + // placeholder for future optional parameters +} + +// HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get method. +type HybridIdentityMetadataClientGetOptions struct { + // placeholder for future optional parameters +} + +// HybridIdentityMetadataClientListOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListPager +// method. +type HybridIdentityMetadataClientListOptions struct { + // placeholder for future optional parameters +} + +// LogicalNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the LogicalNetworksClient.BeginCreateOrUpdate +// method. +type LogicalNetworksClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LogicalNetworksClientBeginDeleteOptions contains the optional parameters for the LogicalNetworksClient.BeginDelete method. +type LogicalNetworksClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LogicalNetworksClientBeginUpdateOptions contains the optional parameters for the LogicalNetworksClient.BeginUpdate method. +type LogicalNetworksClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LogicalNetworksClientGetOptions contains the optional parameters for the LogicalNetworksClient.Get method. +type LogicalNetworksClientGetOptions struct { + // placeholder for future optional parameters +} + +// LogicalNetworksClientListAllOptions contains the optional parameters for the LogicalNetworksClient.NewListAllPager method. +type LogicalNetworksClientListAllOptions struct { + // placeholder for future optional parameters +} + +// LogicalNetworksClientListOptions contains the optional parameters for the LogicalNetworksClient.NewListPager method. +type LogicalNetworksClientListOptions struct { + // placeholder for future optional parameters +} + +// MarketplaceGalleryImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the MarketplaceGalleryImagesClient.BeginCreateOrUpdate +// method. +type MarketplaceGalleryImagesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MarketplaceGalleryImagesClientBeginDeleteOptions contains the optional parameters for the MarketplaceGalleryImagesClient.BeginDelete +// method. +type MarketplaceGalleryImagesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MarketplaceGalleryImagesClientBeginUpdateOptions contains the optional parameters for the MarketplaceGalleryImagesClient.BeginUpdate +// method. +type MarketplaceGalleryImagesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MarketplaceGalleryImagesClientGetOptions contains the optional parameters for the MarketplaceGalleryImagesClient.Get method. +type MarketplaceGalleryImagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// MarketplaceGalleryImagesClientListAllOptions contains the optional parameters for the MarketplaceGalleryImagesClient.NewListAllPager +// method. +type MarketplaceGalleryImagesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// MarketplaceGalleryImagesClientListOptions contains the optional parameters for the MarketplaceGalleryImagesClient.NewListPager +// method. +type MarketplaceGalleryImagesClientListOptions struct { + // placeholder for future optional parameters +} + +// NetworkInterfacesClientBeginCreateOrUpdateOptions contains the optional parameters for the NetworkInterfacesClient.BeginCreateOrUpdate +// method. +type NetworkInterfacesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NetworkInterfacesClientBeginDeleteOptions contains the optional parameters for the NetworkInterfacesClient.BeginDelete +// method. +type NetworkInterfacesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NetworkInterfacesClientBeginUpdateOptions contains the optional parameters for the NetworkInterfacesClient.BeginUpdate +// method. +type NetworkInterfacesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NetworkInterfacesClientGetOptions contains the optional parameters for the NetworkInterfacesClient.Get method. +type NetworkInterfacesClientGetOptions struct { + // placeholder for future optional parameters +} + +// NetworkInterfacesClientListAllOptions contains the optional parameters for the NetworkInterfacesClient.NewListAllPager +// method. +type NetworkInterfacesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// NetworkInterfacesClientListOptions contains the optional parameters for the NetworkInterfacesClient.NewListPager method. +type NetworkInterfacesClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// StorageContainersClientBeginCreateOrUpdateOptions contains the optional parameters for the StorageContainersClient.BeginCreateOrUpdate +// method. +type StorageContainersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// StorageContainersClientBeginDeleteOptions contains the optional parameters for the StorageContainersClient.BeginDelete +// method. +type StorageContainersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// StorageContainersClientBeginUpdateOptions contains the optional parameters for the StorageContainersClient.BeginUpdate +// method. +type StorageContainersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// StorageContainersClientGetOptions contains the optional parameters for the StorageContainersClient.Get method. +type StorageContainersClientGetOptions struct { + // placeholder for future optional parameters +} + +// StorageContainersClientListAllOptions contains the optional parameters for the StorageContainersClient.NewListAllPager +// method. +type StorageContainersClientListAllOptions struct { + // placeholder for future optional parameters +} + +// StorageContainersClientListOptions contains the optional parameters for the StorageContainersClient.NewListPager method. +type StorageContainersClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualHardDisksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualHardDisksClient.BeginCreateOrUpdate +// method. +type VirtualHardDisksClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHardDisksClientBeginDeleteOptions contains the optional parameters for the VirtualHardDisksClient.BeginDelete method. +type VirtualHardDisksClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHardDisksClientBeginUpdateOptions contains the optional parameters for the VirtualHardDisksClient.BeginUpdate method. +type VirtualHardDisksClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHardDisksClientGetOptions contains the optional parameters for the VirtualHardDisksClient.Get method. +type VirtualHardDisksClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualHardDisksClientListAllOptions contains the optional parameters for the VirtualHardDisksClient.NewListAllPager method. +type VirtualHardDisksClientListAllOptions struct { + // placeholder for future optional parameters +} + +// VirtualHardDisksClientListOptions contains the optional parameters for the VirtualHardDisksClient.NewListPager method. +type VirtualHardDisksClientListOptions 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 { + // 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 { + // 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 +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go index 34f9e3a7a8b6..fa2dcffd9882 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go @@ -3,113 +3,294 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armazurestackhci -// ArcSettingsClientCreateIdentityResponse contains the response from method ArcSettingsClient.BeginCreateIdentity. -type ArcSettingsClientCreateIdentityResponse struct { - ArcIdentityResponse +// GalleryImagesClientCreateOrUpdateResponse contains the response from method GalleryImagesClient.BeginCreateOrUpdate. +type GalleryImagesClientCreateOrUpdateResponse struct { + // The gallery images resource definition. + GalleryImages } -// ArcSettingsClientCreateResponse contains the response from method ArcSettingsClient.Create. -type ArcSettingsClientCreateResponse struct { - ArcSetting +// GalleryImagesClientDeleteResponse contains the response from method GalleryImagesClient.BeginDelete. +type GalleryImagesClientDeleteResponse struct { + // placeholder for future response values } -// ArcSettingsClientDeleteResponse contains the response from method ArcSettingsClient.BeginDelete. -type ArcSettingsClientDeleteResponse struct { - // placeholder for future response values +// GalleryImagesClientGetResponse contains the response from method GalleryImagesClient.Get. +type GalleryImagesClientGetResponse struct { + // The gallery images resource definition. + GalleryImages } -// ArcSettingsClientGeneratePasswordResponse contains the response from method ArcSettingsClient.GeneratePassword. -type ArcSettingsClientGeneratePasswordResponse struct { - PasswordCredential +// GalleryImagesClientListAllResponse contains the response from method GalleryImagesClient.NewListAllPager. +type GalleryImagesClientListAllResponse struct { + // List of gallery images. + GalleryImagesListResult } -// ArcSettingsClientGetResponse contains the response from method ArcSettingsClient.Get. -type ArcSettingsClientGetResponse struct { - ArcSetting +// GalleryImagesClientListResponse contains the response from method GalleryImagesClient.NewListPager. +type GalleryImagesClientListResponse struct { + // List of gallery images. + GalleryImagesListResult +} + +// GalleryImagesClientUpdateResponse contains the response from method GalleryImagesClient.BeginUpdate. +type GalleryImagesClientUpdateResponse struct { + // The gallery images resource definition. + GalleryImages +} + +// GuestAgentClientCreateResponse contains the response from method GuestAgentClient.BeginCreate. +type GuestAgentClientCreateResponse struct { + // Defines the GuestAgent. + GuestAgent +} + +// GuestAgentClientDeleteResponse contains the response from method GuestAgentClient.BeginDelete. +type GuestAgentClientDeleteResponse struct { + // placeholder for future response values } -// ArcSettingsClientListByClusterResponse contains the response from method ArcSettingsClient.NewListByClusterPager. -type ArcSettingsClientListByClusterResponse struct { - ArcSettingList +// GuestAgentClientGetResponse contains the response from method GuestAgentClient.Get. +type GuestAgentClientGetResponse struct { + // Defines the GuestAgent. + GuestAgent } -// ArcSettingsClientUpdateResponse contains the response from method ArcSettingsClient.Update. -type ArcSettingsClientUpdateResponse struct { - ArcSetting +// GuestAgentsClientListResponse contains the response from method GuestAgentsClient.NewListPager. +type GuestAgentsClientListResponse struct { + // List of GuestAgent. + GuestAgentList } -// ClustersClientCreateIdentityResponse contains the response from method ClustersClient.BeginCreateIdentity. -type ClustersClientCreateIdentityResponse struct { - ClusterIdentityResponse +// HybridIdentityMetadataClientGetResponse contains the response from method HybridIdentityMetadataClient.Get. +type HybridIdentityMetadataClientGetResponse struct { + // Defines the HybridIdentityMetadata. + HybridIdentityMetadata } -// ClustersClientCreateResponse contains the response from method ClustersClient.Create. -type ClustersClientCreateResponse struct { - Cluster +// HybridIdentityMetadataClientListResponse contains the response from method HybridIdentityMetadataClient.NewListPager. +type HybridIdentityMetadataClientListResponse struct { + // List of HybridIdentityMetadata. + HybridIdentityMetadataList } -// ClustersClientDeleteResponse contains the response from method ClustersClient.BeginDelete. -type ClustersClientDeleteResponse struct { +// LogicalNetworksClientCreateOrUpdateResponse contains the response from method LogicalNetworksClient.BeginCreateOrUpdate. +type LogicalNetworksClientCreateOrUpdateResponse struct { + // The logical network resource definition. + LogicalNetworks +} + +// LogicalNetworksClientDeleteResponse contains the response from method LogicalNetworksClient.BeginDelete. +type LogicalNetworksClientDeleteResponse struct { // placeholder for future response values } -// ClustersClientGetResponse contains the response from method ClustersClient.Get. -type ClustersClientGetResponse struct { - Cluster +// LogicalNetworksClientGetResponse contains the response from method LogicalNetworksClient.Get. +type LogicalNetworksClientGetResponse struct { + // The logical network resource definition. + LogicalNetworks +} + +// LogicalNetworksClientListAllResponse contains the response from method LogicalNetworksClient.NewListAllPager. +type LogicalNetworksClientListAllResponse struct { + LogicalNetworksListResult } -// ClustersClientListByResourceGroupResponse contains the response from method ClustersClient.NewListByResourceGroupPager. -type ClustersClientListByResourceGroupResponse struct { - ClusterList +// LogicalNetworksClientListResponse contains the response from method LogicalNetworksClient.NewListPager. +type LogicalNetworksClientListResponse struct { + LogicalNetworksListResult } -// ClustersClientListBySubscriptionResponse contains the response from method ClustersClient.NewListBySubscriptionPager. -type ClustersClientListBySubscriptionResponse struct { - ClusterList +// LogicalNetworksClientUpdateResponse contains the response from method LogicalNetworksClient.BeginUpdate. +type LogicalNetworksClientUpdateResponse struct { + // The logical network resource definition. + LogicalNetworks } -// ClustersClientUpdateResponse contains the response from method ClustersClient.Update. -type ClustersClientUpdateResponse struct { - Cluster +// MarketplaceGalleryImagesClientCreateOrUpdateResponse contains the response from method MarketplaceGalleryImagesClient.BeginCreateOrUpdate. +type MarketplaceGalleryImagesClientCreateOrUpdateResponse struct { + // The marketplace gallery image resource definition. + MarketplaceGalleryImages } -// ClustersClientUploadCertificateResponse contains the response from method ClustersClient.BeginUploadCertificate. -type ClustersClientUploadCertificateResponse struct { +// MarketplaceGalleryImagesClientDeleteResponse contains the response from method MarketplaceGalleryImagesClient.BeginDelete. +type MarketplaceGalleryImagesClientDeleteResponse struct { // placeholder for future response values } -// ExtensionsClientCreateResponse contains the response from method ExtensionsClient.BeginCreate. -type ExtensionsClientCreateResponse struct { - Extension +// MarketplaceGalleryImagesClientGetResponse contains the response from method MarketplaceGalleryImagesClient.Get. +type MarketplaceGalleryImagesClientGetResponse struct { + // The marketplace gallery image resource definition. + MarketplaceGalleryImages +} + +// MarketplaceGalleryImagesClientListAllResponse contains the response from method MarketplaceGalleryImagesClient.NewListAllPager. +type MarketplaceGalleryImagesClientListAllResponse struct { + MarketplaceGalleryImagesListResult +} + +// MarketplaceGalleryImagesClientListResponse contains the response from method MarketplaceGalleryImagesClient.NewListPager. +type MarketplaceGalleryImagesClientListResponse struct { + MarketplaceGalleryImagesListResult } -// ExtensionsClientDeleteResponse contains the response from method ExtensionsClient.BeginDelete. -type ExtensionsClientDeleteResponse struct { +// MarketplaceGalleryImagesClientUpdateResponse contains the response from method MarketplaceGalleryImagesClient.BeginUpdate. +type MarketplaceGalleryImagesClientUpdateResponse struct { + // The marketplace gallery image resource definition. + MarketplaceGalleryImages +} + +// NetworkInterfacesClientCreateOrUpdateResponse contains the response from method NetworkInterfacesClient.BeginCreateOrUpdate. +type NetworkInterfacesClientCreateOrUpdateResponse struct { + // The network interface resource definition. + NetworkInterfaces +} + +// NetworkInterfacesClientDeleteResponse contains the response from method NetworkInterfacesClient.BeginDelete. +type NetworkInterfacesClientDeleteResponse struct { // placeholder for future response values } -// ExtensionsClientGetResponse contains the response from method ExtensionsClient.Get. -type ExtensionsClientGetResponse struct { - Extension +// NetworkInterfacesClientGetResponse contains the response from method NetworkInterfacesClient.Get. +type NetworkInterfacesClientGetResponse struct { + // The network interface resource definition. + NetworkInterfaces } -// ExtensionsClientListByArcSettingResponse contains the response from method ExtensionsClient.NewListByArcSettingPager. -type ExtensionsClientListByArcSettingResponse struct { - ExtensionList +// NetworkInterfacesClientListAllResponse contains the response from method NetworkInterfacesClient.NewListAllPager. +type NetworkInterfacesClientListAllResponse struct { + NetworkInterfacesListResult } -// ExtensionsClientUpdateResponse contains the response from method ExtensionsClient.BeginUpdate. -type ExtensionsClientUpdateResponse struct { - Extension +// NetworkInterfacesClientListResponse contains the response from method NetworkInterfacesClient.NewListPager. +type NetworkInterfacesClientListResponse struct { + NetworkInterfacesListResult } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// NetworkInterfacesClientUpdateResponse contains the response from method NetworkInterfacesClient.BeginUpdate. +type NetworkInterfacesClientUpdateResponse struct { + // The network interface resource definition. + NetworkInterfaces +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } + +// StorageContainersClientCreateOrUpdateResponse contains the response from method StorageContainersClient.BeginCreateOrUpdate. +type StorageContainersClientCreateOrUpdateResponse struct { + // The storage container resource definition. + StorageContainers +} + +// StorageContainersClientDeleteResponse contains the response from method StorageContainersClient.BeginDelete. +type StorageContainersClientDeleteResponse struct { + // placeholder for future response values +} + +// StorageContainersClientGetResponse contains the response from method StorageContainersClient.Get. +type StorageContainersClientGetResponse struct { + // The storage container resource definition. + StorageContainers +} + +// StorageContainersClientListAllResponse contains the response from method StorageContainersClient.NewListAllPager. +type StorageContainersClientListAllResponse struct { + StorageContainersListResult +} + +// StorageContainersClientListResponse contains the response from method StorageContainersClient.NewListPager. +type StorageContainersClientListResponse struct { + StorageContainersListResult +} + +// StorageContainersClientUpdateResponse contains the response from method StorageContainersClient.BeginUpdate. +type StorageContainersClientUpdateResponse struct { + // The storage container resource definition. + StorageContainers +} + +// VirtualHardDisksClientCreateOrUpdateResponse contains the response from method VirtualHardDisksClient.BeginCreateOrUpdate. +type VirtualHardDisksClientCreateOrUpdateResponse struct { + // The virtual hard disk resource definition. + VirtualHardDisks +} + +// VirtualHardDisksClientDeleteResponse contains the response from method VirtualHardDisksClient.BeginDelete. +type VirtualHardDisksClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualHardDisksClientGetResponse contains the response from method VirtualHardDisksClient.Get. +type VirtualHardDisksClientGetResponse struct { + // The virtual hard disk resource definition. + VirtualHardDisks +} + +// VirtualHardDisksClientListAllResponse contains the response from method VirtualHardDisksClient.NewListAllPager. +type VirtualHardDisksClientListAllResponse struct { + VirtualHardDisksListResult +} + +// VirtualHardDisksClientListResponse contains the response from method VirtualHardDisksClient.NewListPager. +type VirtualHardDisksClientListResponse struct { + VirtualHardDisksListResult +} + +// VirtualHardDisksClientUpdateResponse contains the response from method VirtualHardDisksClient.BeginUpdate. +type VirtualHardDisksClientUpdateResponse struct { + // The virtual hard disk resource definition. + VirtualHardDisks +} + +// VirtualMachineInstancesClientCreateOrUpdateResponse contains the response from method VirtualMachineInstancesClient.BeginCreateOrUpdate. +type VirtualMachineInstancesClientCreateOrUpdateResponse struct { + // The virtual machine instance resource definition. + VirtualMachineInstance +} + +// VirtualMachineInstancesClientDeleteResponse contains the response from method VirtualMachineInstancesClient.BeginDelete. +type VirtualMachineInstancesClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineInstancesClientGetResponse contains the response from method VirtualMachineInstancesClient.Get. +type VirtualMachineInstancesClientGetResponse struct { + // The virtual machine instance resource definition. + VirtualMachineInstance +} + +// VirtualMachineInstancesClientListResponse contains the response from method VirtualMachineInstancesClient.NewListPager. +type VirtualMachineInstancesClientListResponse struct { + VirtualMachineInstanceListResult +} + +// VirtualMachineInstancesClientRestartResponse contains the response from method VirtualMachineInstancesClient.BeginRestart. +type VirtualMachineInstancesClientRestartResponse struct { + // The virtual machine instance resource definition. + VirtualMachineInstance +} + +// VirtualMachineInstancesClientStartResponse contains the response from method VirtualMachineInstancesClient.BeginStart. +type VirtualMachineInstancesClientStartResponse struct { + // The virtual machine instance resource definition. + VirtualMachineInstance +} + +// VirtualMachineInstancesClientStopResponse contains the response from method VirtualMachineInstancesClient.BeginStop. +type VirtualMachineInstancesClientStopResponse struct { + // The virtual machine instance resource definition. + VirtualMachineInstance +} + +// VirtualMachineInstancesClientUpdateResponse contains the response from method VirtualMachineInstancesClient.BeginUpdate. +type VirtualMachineInstancesClientUpdateResponse struct { + // The virtual machine instance resource definition. + VirtualMachineInstance +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client.go new file mode 100644 index 000000000000..f1fa13ba12f3 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client.go @@ -0,0 +1,449 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurestackhci + +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" +) + +// StorageContainersClient contains the methods for the StorageContainers group. +// Don't use this type directly, use NewStorageContainersClient() instead. +type StorageContainersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewStorageContainersClient creates a new instance of StorageContainersClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewStorageContainersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StorageContainersClient, error) { + cl, err := arm.NewClient(moduleName+".StorageContainersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &StorageContainersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a storage container. Please note some properties can be set only +// during storage container creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - storageContainerName - Name of the storage container +// - options - StorageContainersClientBeginCreateOrUpdateOptions contains the optional parameters for the StorageContainersClient.BeginCreateOrUpdate +// method. +func (client *StorageContainersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, storageContainerName string, storageContainers StorageContainers, options *StorageContainersClientBeginCreateOrUpdateOptions) (*runtime.Poller[StorageContainersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, storageContainerName, storageContainers, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[StorageContainersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[StorageContainersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - The operation to create or update a storage container. Please note some properties can be set only during +// storage container creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *StorageContainersClient) createOrUpdate(ctx context.Context, resourceGroupName string, storageContainerName string, storageContainers StorageContainers, options *StorageContainersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, storageContainerName, storageContainers, 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 *StorageContainersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, storageContainerName string, storageContainers StorageContainers, options *StorageContainersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + 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 storageContainerName == "" { + return nil, errors.New("parameter storageContainerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageContainerName}", url.PathEscape(storageContainerName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, storageContainers); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete a storage container. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - storageContainerName - Name of the storage container +// - options - StorageContainersClientBeginDeleteOptions contains the optional parameters for the StorageContainersClient.BeginDelete +// method. +func (client *StorageContainersClient) BeginDelete(ctx context.Context, resourceGroupName string, storageContainerName string, options *StorageContainersClientBeginDeleteOptions) (*runtime.Poller[StorageContainersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, storageContainerName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[StorageContainersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[StorageContainersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - The operation to delete a storage container. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *StorageContainersClient) deleteOperation(ctx context.Context, resourceGroupName string, storageContainerName string, options *StorageContainersClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, storageContainerName, 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 *StorageContainersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageContainerName string, options *StorageContainersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + 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 storageContainerName == "" { + return nil, errors.New("parameter storageContainerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageContainerName}", url.PathEscape(storageContainerName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a storage container +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - storageContainerName - Name of the storage container +// - options - StorageContainersClientGetOptions contains the optional parameters for the StorageContainersClient.Get method. +func (client *StorageContainersClient) Get(ctx context.Context, resourceGroupName string, storageContainerName string, options *StorageContainersClientGetOptions) (StorageContainersClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, storageContainerName, options) + if err != nil { + return StorageContainersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StorageContainersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return StorageContainersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *StorageContainersClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageContainerName string, options *StorageContainersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + 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 storageContainerName == "" { + return nil, errors.New("parameter storageContainerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageContainerName}", url.PathEscape(storageContainerName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StorageContainersClient) getHandleResponse(resp *http.Response) (StorageContainersClientGetResponse, error) { + result := StorageContainersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageContainers); err != nil { + return StorageContainersClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all of the storage containers in the specified resource group. Use the nextLink property in the response +// to get the next page of storage containers. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - StorageContainersClientListOptions contains the optional parameters for the StorageContainersClient.NewListPager +// method. +func (client *StorageContainersClient) NewListPager(resourceGroupName string, options *StorageContainersClientListOptions) *runtime.Pager[StorageContainersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[StorageContainersClientListResponse]{ + More: func(page StorageContainersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *StorageContainersClientListResponse) (StorageContainersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return StorageContainersClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StorageContainersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StorageContainersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *StorageContainersClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *StorageContainersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers" + 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", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *StorageContainersClient) listHandleResponse(resp *http.Response) (StorageContainersClientListResponse, error) { + result := StorageContainersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageContainersListResult); err != nil { + return StorageContainersClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Lists all of the storage containers in the specified subscription. Use the nextLink property in the response +// to get the next page of storage containers. +// +// Generated from API version 2023-09-01-preview +// - options - StorageContainersClientListAllOptions contains the optional parameters for the StorageContainersClient.NewListAllPager +// method. +func (client *StorageContainersClient) NewListAllPager(options *StorageContainersClientListAllOptions) *runtime.Pager[StorageContainersClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[StorageContainersClientListAllResponse]{ + More: func(page StorageContainersClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *StorageContainersClientListAllResponse) (StorageContainersClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return StorageContainersClientListAllResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StorageContainersClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StorageContainersClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *StorageContainersClient) listAllCreateRequest(ctx context.Context, options *StorageContainersClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storageContainers" + 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", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *StorageContainersClient) listAllHandleResponse(resp *http.Response) (StorageContainersClientListAllResponse, error) { + result := StorageContainersClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageContainersListResult); err != nil { + return StorageContainersClientListAllResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update a storage container. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - storageContainerName - Name of the storage container +// - options - StorageContainersClientBeginUpdateOptions contains the optional parameters for the StorageContainersClient.BeginUpdate +// method. +func (client *StorageContainersClient) BeginUpdate(ctx context.Context, resourceGroupName string, storageContainerName string, storageContainers StorageContainersUpdateRequest, options *StorageContainersClientBeginUpdateOptions) (*runtime.Poller[StorageContainersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, storageContainerName, storageContainers, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[StorageContainersClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[StorageContainersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - The operation to update a storage container. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *StorageContainersClient) update(ctx context.Context, resourceGroupName string, storageContainerName string, storageContainers StorageContainersUpdateRequest, options *StorageContainersClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, storageContainerName, storageContainers, 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 *StorageContainersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, storageContainerName string, storageContainers StorageContainersUpdateRequest, options *StorageContainersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + 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 storageContainerName == "" { + return nil, errors.New("parameter storageContainerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageContainerName}", url.PathEscape(storageContainerName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, storageContainers); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client_example_test.go new file mode 100644 index 000000000000..7337c9072a8a --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client_example_test.go @@ -0,0 +1,250 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armazurestackhci_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/azurestackhci/armazurestackhci/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetStorageContainer.json +func ExampleStorageContainersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewStorageContainersClient().Get(ctx, "test-rg", "Default_Container", 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.StorageContainers = armazurestackhci.StorageContainers{ + // Name: to.Ptr("Default_Container"), + // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/Default_Container"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.StorageContainerProperties{ + // Path: to.Ptr("C:\\container_storage"), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutStorageContainer.json +func ExampleStorageContainersClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewStorageContainersClient().BeginCreateOrUpdate(ctx, "test-rg", "Default_Container", armazurestackhci.StorageContainers{ + Location: to.Ptr("West US2"), + ExtendedLocation: &armazurestackhci.ExtendedLocation{ + Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + }, + Properties: &armazurestackhci.StorageContainerProperties{ + Path: to.Ptr("C:\\container_storage"), + }, + }, 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.StorageContainers = armazurestackhci.StorageContainers{ + // Name: to.Ptr("Default_Container"), + // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-galimg3325"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.StorageContainerProperties{ + // Path: to.Ptr("C:\\container_storage"), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteStorageContainer.json +func ExampleStorageContainersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewStorageContainersClient().BeginDelete(ctx, "test-rg", "Default_Container", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateStorageContainer.json +func ExampleStorageContainersClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewStorageContainersClient().BeginUpdate(ctx, "test-rg", "Default_Container", armazurestackhci.StorageContainersUpdateRequest{ + Tags: map[string]*string{ + "additionalProperties": to.Ptr("sample"), + }, + }, 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.StorageContainers = armazurestackhci.StorageContainers{ + // Name: to.Ptr("Default_Container"), + // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-galimg3325"), + // Location: to.Ptr("West US2"), + // Tags: map[string]*string{ + // "additionalProperties": to.Ptr("sample"), + // }, + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.StorageContainerProperties{ + // Path: to.Ptr("C:\\container_storage"), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListStorageContainerByResourceGroup.json +func ExampleStorageContainersClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewStorageContainersClient().NewListPager("test-rg", 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.StorageContainersListResult = armazurestackhci.StorageContainersListResult{ + // Value: []*armazurestackhci.StorageContainers{ + // { + // Name: to.Ptr("Default_Container"), + // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/Default_Container"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.StorageContainerProperties{ + // Path: to.Ptr("C:\\container_storage"), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListStorageContainerBySubscription.json +func ExampleStorageContainersClient_NewListAllPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewStorageContainersClient().NewListAllPager(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.StorageContainersListResult = armazurestackhci.StorageContainersListResult{ + // Value: []*armazurestackhci.StorageContainers{ + // { + // Name: to.Ptr("Default_Container"), + // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/Default_Container"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.StorageContainerProperties{ + // Path: to.Ptr("C:\\container_storage"), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go index 4e74083db8c9..f48465f7eb74 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armazurestackhci diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client.go new file mode 100644 index 000000000000..6364b65bda8b --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client.go @@ -0,0 +1,449 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurestackhci + +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" +) + +// VirtualHardDisksClient contains the methods for the VirtualHardDisks group. +// Don't use this type directly, use NewVirtualHardDisksClient() instead. +type VirtualHardDisksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVirtualHardDisksClient creates a new instance of VirtualHardDisksClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVirtualHardDisksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualHardDisksClient, error) { + cl, err := arm.NewClient(moduleName+".VirtualHardDisksClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualHardDisksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a virtual hard disk. Please note some properties can be set only +// during virtual hard disk creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - virtualHardDiskName - Name of the virtual hard disk +// - options - VirtualHardDisksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualHardDisksClient.BeginCreateOrUpdate +// method. +func (client *VirtualHardDisksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHardDiskName string, virtualHardDisks VirtualHardDisks, options *VirtualHardDisksClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualHardDisksClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualHardDiskName, virtualHardDisks, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHardDisksClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHardDisksClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - The operation to create or update a virtual hard disk. Please note some properties can be set only during +// virtual hard disk creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *VirtualHardDisksClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHardDiskName string, virtualHardDisks VirtualHardDisks, options *VirtualHardDisksClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHardDiskName, virtualHardDisks, 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 *VirtualHardDisksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualHardDiskName string, virtualHardDisks VirtualHardDisks, options *VirtualHardDisksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + 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 virtualHardDiskName == "" { + return nil, errors.New("parameter virtualHardDiskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHardDiskName}", url.PathEscape(virtualHardDiskName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, virtualHardDisks); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete a virtual hard disk. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - virtualHardDiskName - Name of the virtual hard disk +// - options - VirtualHardDisksClientBeginDeleteOptions contains the optional parameters for the VirtualHardDisksClient.BeginDelete +// method. +func (client *VirtualHardDisksClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualHardDiskName string, options *VirtualHardDisksClientBeginDeleteOptions) (*runtime.Poller[VirtualHardDisksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualHardDiskName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHardDisksClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHardDisksClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - The operation to delete a virtual hard disk. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *VirtualHardDisksClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHardDiskName string, options *VirtualHardDisksClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHardDiskName, 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 *VirtualHardDisksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualHardDiskName string, options *VirtualHardDisksClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + 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 virtualHardDiskName == "" { + return nil, errors.New("parameter virtualHardDiskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHardDiskName}", url.PathEscape(virtualHardDiskName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a virtual hard disk +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - virtualHardDiskName - Name of the virtual hard disk +// - options - VirtualHardDisksClientGetOptions contains the optional parameters for the VirtualHardDisksClient.Get method. +func (client *VirtualHardDisksClient) Get(ctx context.Context, resourceGroupName string, virtualHardDiskName string, options *VirtualHardDisksClientGetOptions) (VirtualHardDisksClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHardDiskName, options) + if err != nil { + return VirtualHardDisksClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualHardDisksClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualHardDisksClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VirtualHardDisksClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualHardDiskName string, options *VirtualHardDisksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + 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 virtualHardDiskName == "" { + return nil, errors.New("parameter virtualHardDiskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHardDiskName}", url.PathEscape(virtualHardDiskName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualHardDisksClient) getHandleResponse(resp *http.Response) (VirtualHardDisksClientGetResponse, error) { + result := VirtualHardDisksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualHardDisks); err != nil { + return VirtualHardDisksClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response +// to get the next page of virtual hard disks. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - VirtualHardDisksClientListOptions contains the optional parameters for the VirtualHardDisksClient.NewListPager +// method. +func (client *VirtualHardDisksClient) NewListPager(resourceGroupName string, options *VirtualHardDisksClientListOptions) *runtime.Pager[VirtualHardDisksClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualHardDisksClientListResponse]{ + More: func(page VirtualHardDisksClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualHardDisksClientListResponse) (VirtualHardDisksClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualHardDisksClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualHardDisksClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualHardDisksClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualHardDisksClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualHardDisksClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks" + 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", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualHardDisksClient) listHandleResponse(resp *http.Response) (VirtualHardDisksClientListResponse, error) { + result := VirtualHardDisksClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualHardDisksListResult); err != nil { + return VirtualHardDisksClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response +// to get the next page of virtual hard disks. +// +// Generated from API version 2023-09-01-preview +// - options - VirtualHardDisksClientListAllOptions contains the optional parameters for the VirtualHardDisksClient.NewListAllPager +// method. +func (client *VirtualHardDisksClient) NewListAllPager(options *VirtualHardDisksClientListAllOptions) *runtime.Pager[VirtualHardDisksClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualHardDisksClientListAllResponse]{ + More: func(page VirtualHardDisksClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualHardDisksClientListAllResponse) (VirtualHardDisksClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualHardDisksClientListAllResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualHardDisksClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualHardDisksClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *VirtualHardDisksClient) listAllCreateRequest(ctx context.Context, options *VirtualHardDisksClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualHardDisks" + 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", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *VirtualHardDisksClient) listAllHandleResponse(resp *http.Response) (VirtualHardDisksClientListAllResponse, error) { + result := VirtualHardDisksClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualHardDisksListResult); err != nil { + return VirtualHardDisksClientListAllResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update a virtual hard disk. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - virtualHardDiskName - Name of the virtual hard disk +// - options - VirtualHardDisksClientBeginUpdateOptions contains the optional parameters for the VirtualHardDisksClient.BeginUpdate +// method. +func (client *VirtualHardDisksClient) BeginUpdate(ctx context.Context, resourceGroupName string, virtualHardDiskName string, virtualHardDisks VirtualHardDisksUpdateRequest, options *VirtualHardDisksClientBeginUpdateOptions) (*runtime.Poller[VirtualHardDisksClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, virtualHardDiskName, virtualHardDisks, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHardDisksClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHardDisksClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - The operation to update a virtual hard disk. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *VirtualHardDisksClient) update(ctx context.Context, resourceGroupName string, virtualHardDiskName string, virtualHardDisks VirtualHardDisksUpdateRequest, options *VirtualHardDisksClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, virtualHardDiskName, virtualHardDisks, 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 *VirtualHardDisksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualHardDiskName string, virtualHardDisks VirtualHardDisksUpdateRequest, options *VirtualHardDisksClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + 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 virtualHardDiskName == "" { + return nil, errors.New("parameter virtualHardDiskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHardDiskName}", url.PathEscape(virtualHardDiskName)) + 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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, virtualHardDisks); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client_example_test.go new file mode 100644 index 000000000000..b748f67a2209 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client_example_test.go @@ -0,0 +1,280 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armazurestackhci_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/azurestackhci/armazurestackhci/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetVirtualHardDisk.json +func ExampleVirtualHardDisksClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewVirtualHardDisksClient().Get(ctx, "test-rg", "test-vhd", 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.VirtualHardDisks = armazurestackhci.VirtualHardDisks{ + // Name: to.Ptr("test-vhd"), + // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualHardDiskProperties{ + // BlockSizeBytes: to.Ptr[int32](0), + // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), + // DiskSizeGB: to.Ptr[int64](32), + // Dynamic: to.Ptr(true), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), + // LogicalSectorBytes: to.Ptr[int32](512), + // PhysicalSectorBytes: to.Ptr[int32](512), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualHardDisk.json +func ExampleVirtualHardDisksClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVirtualHardDisksClient().BeginCreateOrUpdate(ctx, "test-rg", "test-vhd", armazurestackhci.VirtualHardDisks{ + Location: to.Ptr("West US2"), + ExtendedLocation: &armazurestackhci.ExtendedLocation{ + Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + }, + Properties: &armazurestackhci.VirtualHardDiskProperties{ + DiskSizeGB: to.Ptr[int64](32), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // 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.VirtualHardDisks = armazurestackhci.VirtualHardDisks{ + // Name: to.Ptr("test-vhd"), + // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualHardDiskProperties{ + // BlockSizeBytes: to.Ptr[int32](0), + // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), + // DiskSizeGB: to.Ptr[int64](32), + // Dynamic: to.Ptr(true), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), + // LogicalSectorBytes: to.Ptr[int32](512), + // PhysicalSectorBytes: to.Ptr[int32](512), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteVirtualHardDisk.json +func ExampleVirtualHardDisksClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVirtualHardDisksClient().BeginDelete(ctx, "test-rg", "test-vhd", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateVirtualHardDisk.json +func ExampleVirtualHardDisksClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVirtualHardDisksClient().BeginUpdate(ctx, "test-rg", "test-vhd", armazurestackhci.VirtualHardDisksUpdateRequest{ + Tags: map[string]*string{ + "additionalProperties": to.Ptr("sample"), + }, + }, 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.VirtualHardDisks = armazurestackhci.VirtualHardDisks{ + // Name: to.Ptr("test-vhd"), + // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), + // Location: to.Ptr("West US2"), + // Tags: map[string]*string{ + // "additionalProperties": to.Ptr("sample"), + // }, + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualHardDiskProperties{ + // BlockSizeBytes: to.Ptr[int32](0), + // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), + // DiskSizeGB: to.Ptr[int64](32), + // Dynamic: to.Ptr(true), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), + // LogicalSectorBytes: to.Ptr[int32](512), + // PhysicalSectorBytes: to.Ptr[int32](512), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListVirtualHardDiskByResourceGroup.json +func ExampleVirtualHardDisksClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewVirtualHardDisksClient().NewListPager("test-rg", 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.VirtualHardDisksListResult = armazurestackhci.VirtualHardDisksListResult{ + // Value: []*armazurestackhci.VirtualHardDisks{ + // { + // Name: to.Ptr("test-vhd"), + // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualHardDiskProperties{ + // BlockSizeBytes: to.Ptr[int32](0), + // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), + // DiskSizeGB: to.Ptr[int64](32), + // Dynamic: to.Ptr(true), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), + // LogicalSectorBytes: to.Ptr[int32](512), + // PhysicalSectorBytes: to.Ptr[int32](512), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListVirtualHardDiskBySubscription.json +func ExampleVirtualHardDisksClient_NewListAllPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewVirtualHardDisksClient().NewListAllPager(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.VirtualHardDisksListResult = armazurestackhci.VirtualHardDisksListResult{ + // Value: []*armazurestackhci.VirtualHardDisks{ + // { + // Name: to.Ptr("test-vhd"), + // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), + // Location: to.Ptr("West US2"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualHardDiskProperties{ + // BlockSizeBytes: to.Ptr[int32](0), + // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), + // DiskSizeGB: to.Ptr[int64](32), + // Dynamic: to.Ptr(true), + // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), + // LogicalSectorBytes: to.Ptr[int32](512), + // PhysicalSectorBytes: to.Ptr[int32](512), + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client.go new file mode 100644 index 000000000000..173e999c0afa --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client.go @@ -0,0 +1,502 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurestackhci + +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" +) + +// 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-09-01-preview +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - VirtualMachineInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginCreateOrUpdate +// method. +func (client *VirtualMachineInstancesClient) BeginCreateOrUpdate(ctx context.Context, resourceURI string, virtualMachineInstance VirtualMachineInstance, options *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachineInstancesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceURI, virtualMachineInstance, 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-09-01-preview +func (client *VirtualMachineInstancesClient) createOrUpdate(ctx context.Context, resourceURI string, virtualMachineInstance VirtualMachineInstance, options *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceURI, virtualMachineInstance, 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, virtualMachineInstance VirtualMachineInstance, options *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, virtualMachineInstance); 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-09-01-preview +// - 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-09-01-preview +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.AzureStackHCI/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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a virtual machine instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - 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.AzureStackHCI/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-09-01-preview") + 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-09-01-preview +// - 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.AzureStackHCI/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-09-01-preview") + 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.VirtualMachineInstanceListResult); 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-09-01-preview +// - 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-09-01-preview +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.StatusOK, 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.AzureStackHCI/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-09-01-preview") + 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-09-01-preview +// - 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-09-01-preview +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.StatusOK, 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.AzureStackHCI/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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStop - The operation to stop a virtual machine instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - 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 stop a virtual machine instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +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.StatusOK, 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.AzureStackHCI/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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + 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-09-01-preview +// - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. +// - options - VirtualMachineInstancesClientBeginUpdateOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginUpdate +// method. +func (client *VirtualMachineInstancesClient) BeginUpdate(ctx context.Context, resourceURI string, virtualMachineInstance VirtualMachineInstanceUpdateRequest, options *VirtualMachineInstancesClientBeginUpdateOptions) (*runtime.Poller[VirtualMachineInstancesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceURI, virtualMachineInstance, 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-09-01-preview +func (client *VirtualMachineInstancesClient) update(ctx context.Context, resourceURI string, virtualMachineInstance VirtualMachineInstanceUpdateRequest, options *VirtualMachineInstancesClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceURI, virtualMachineInstance, 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, virtualMachineInstance VirtualMachineInstanceUpdateRequest, options *VirtualMachineInstancesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/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-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, virtualMachineInstance); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client_example_test.go new file mode 100644 index 000000000000..64d2766e4358 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client_example_test.go @@ -0,0 +1,769 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armazurestackhci_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/azurestackhci/armazurestackhci/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetVirtualMachineInstance.json +func ExampleVirtualMachineInstancesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewVirtualMachineInstancesClient().Get(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/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.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + // }, + // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + // { + // ID: to.Ptr("test-nic"), + // }}, + // }, + // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ + // AdminUsername: to.Ptr("localadmin"), + // ComputerName: to.Ptr("luamaster"), + // }, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + // }, + // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualMachineInstanceWithGalleryImage.json +func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_putVirtualMachineInstanceWithGalleryImage() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstance{ + ExtendedLocation: &armazurestackhci.ExtendedLocation{ + Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + }, + Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + }, + NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + { + ID: to.Ptr("test-nic"), + }}, + }, + OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ + AdminPassword: to.Ptr("password"), + AdminUsername: to.Ptr("localadmin"), + ComputerName: to.Ptr("luamaster"), + }, + SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ + EnableTPM: to.Ptr(true), + UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ + SecureBootEnabled: to.Ptr(true), + }, + }, + StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ + ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + }, + VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), + }, + }, + }, 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.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + // }, + // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + // { + // ID: to.Ptr("test-nic"), + // }}, + // }, + // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ + // AdminUsername: to.Ptr("localadmin"), + // ComputerName: to.Ptr("luamaster"), + // }, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ + // EnableTPM: to.Ptr(true), + // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ + // SecureBootEnabled: to.Ptr(true), + // }, + // }, + // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + // }, + // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualMachineInstanceWithMarketplaceGalleryImage.json +func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_putVirtualMachineInstanceWithMarketplaceGalleryImage() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstance{ + ExtendedLocation: &armazurestackhci.ExtendedLocation{ + Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + }, + Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + }, + NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + { + ID: to.Ptr("test-nic"), + }}, + }, + OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ + AdminPassword: to.Ptr("password"), + AdminUsername: to.Ptr("localadmin"), + ComputerName: to.Ptr("luamaster"), + }, + SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ + EnableTPM: to.Ptr(true), + UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ + SecureBootEnabled: to.Ptr(true), + }, + }, + StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ + ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), + }, + VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), + }, + }, + }, 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.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + // }, + // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + // { + // ID: to.Ptr("test-nic"), + // }}, + // }, + // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ + // AdminUsername: to.Ptr("localadmin"), + // ComputerName: to.Ptr("luamaster"), + // }, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ + // EnableTPM: to.Ptr(true), + // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ + // SecureBootEnabled: to.Ptr(true), + // }, + // }, + // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), + // }, + // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualMachineInstanceWithOsDisk.json +func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_putVirtualMachineInstanceWithOsDisk() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstance{ + ExtendedLocation: &armazurestackhci.ExtendedLocation{ + Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + }, + Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + }, + NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + { + ID: to.Ptr("test-nic"), + }}, + }, + SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ + EnableTPM: to.Ptr(true), + UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ + SecureBootEnabled: to.Ptr(true), + }, + }, + StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + OSDisk: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileOsDisk{ + ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), + }, + VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), + }, + }, + }, 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.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + // }, + // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + // { + // ID: to.Ptr("test-nic"), + // }}, + // }, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ + // EnableTPM: to.Ptr(true), + // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ + // SecureBootEnabled: to.Ptr(true), + // }, + // }, + // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + // OSDisk: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileOsDisk{ + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), + // }, + // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualMachineInstanceWithVMConfigAgent.json +func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_putVirtualMachineInstanceWithVmConfigAgent() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstance{ + ExtendedLocation: &armazurestackhci.ExtendedLocation{ + Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + }, + Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + }, + NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + { + ID: to.Ptr("test-nic"), + }}, + }, + OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ + AdminPassword: to.Ptr("password"), + AdminUsername: to.Ptr("localadmin"), + ComputerName: to.Ptr("luamaster"), + WindowsConfiguration: &armazurestackhci.VirtualMachineInstancePropertiesOsProfileWindowsConfiguration{ + ProvisionVMConfigAgent: to.Ptr(true), + }, + }, + SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ + EnableTPM: to.Ptr(true), + UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ + SecureBootEnabled: to.Ptr(true), + }, + }, + StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ + ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + }, + VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), + }, + }, + }, 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.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + // }, + // InstanceView: &armazurestackhci.VirtualMachineInstanceView{ + // VMAgent: &armazurestackhci.VirtualMachineConfigAgentInstanceView{ + // Statuses: []*armazurestackhci.InstanceViewStatus{ + // { + // Code: to.Ptr("Ok"), + // DisplayStatus: to.Ptr("Ok"), + // Level: to.Ptr(armazurestackhci.StatusLevelTypesInfo), + // Message: to.Ptr("The agent is healthy"), + // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2009-06-15T13:45:30"); return t}()), + // }}, + // VMConfigAgentVersion: to.Ptr("1.0.0"), + // }, + // }, + // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + // { + // ID: to.Ptr("test-nic"), + // }}, + // }, + // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ + // AdminUsername: to.Ptr("localadmin"), + // ComputerName: to.Ptr("luamaster"), + // }, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ + // EnableTPM: to.Ptr(true), + // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ + // SecureBootEnabled: to.Ptr(true), + // }, + // }, + // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + // }, + // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteVirtualMachineInstance.json +func ExampleVirtualMachineInstancesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginDelete(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateVirtualMachineInstance.json +func ExampleVirtualMachineInstancesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstanceUpdateRequest{ + Properties: &armazurestackhci.VirtualMachineInstanceUpdateProperties{ + StorageProfile: &armazurestackhci.StorageProfileUpdate{ + DataDisks: []*armazurestackhci.StorageProfileUpdateDataDisksItem{ + { + ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), + }}, + }, + }, + }, 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.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + // }, + // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + // { + // ID: to.Ptr("test-nic"), + // }}, + // }, + // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ + // AdminUsername: to.Ptr("localadmin"), + // ComputerName: to.Ptr("luamaster"), + // }, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + // DataDisks: []*armazurestackhci.VirtualMachineInstancePropertiesStorageProfileDataDisksItem{ + // { + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), + // }}, + // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/StartVirtualMachineInstance.json +func ExampleVirtualMachineInstancesClient_BeginStart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginStart(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", 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.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + // }, + // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + // { + // ID: to.Ptr("test-nic"), + // }}, + // }, + // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ + // AdminUsername: to.Ptr("localadmin"), + // ComputerName: to.Ptr("luamaster"), + // }, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ + // EnableTPM: to.Ptr(true), + // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ + // SecureBootEnabled: to.Ptr(true), + // }, + // }, + // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + // }, + // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/StopVirtualMachineInstance.json +func ExampleVirtualMachineInstancesClient_BeginStop() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginStop(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", 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.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + // }, + // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + // { + // ID: to.Ptr("test-nic"), + // }}, + // }, + // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ + // AdminUsername: to.Ptr("localadmin"), + // ComputerName: to.Ptr("luamaster"), + // }, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ + // EnableTPM: to.Ptr(true), + // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ + // SecureBootEnabled: to.Ptr(true), + // }, + // }, + // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + // }, + // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/RestartVirtualMachineInstance.json +func ExampleVirtualMachineInstancesClient_BeginRestart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginRestart(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", 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.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + // }, + // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + // { + // ID: to.Ptr("test-nic"), + // }}, + // }, + // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ + // AdminUsername: to.Ptr("localadmin"), + // ComputerName: to.Ptr("luamaster"), + // }, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ + // EnableTPM: to.Ptr(true), + // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ + // SecureBootEnabled: to.Ptr(true), + // }, + // }, + // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + // }, + // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListVirtualMachineInstances.json +func ExampleVirtualMachineInstancesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewVirtualMachineInstancesClient().NewListPager("subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", 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.VirtualMachineInstanceListResult = armazurestackhci.VirtualMachineInstanceListResult{ + // Value: []*armazurestackhci.VirtualMachineInstance{ + // { + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), + // ExtendedLocation: &armazurestackhci.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), + // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ + // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ + // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), + // }, + // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ + // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ + // { + // ID: to.Ptr("test-nic"), + // }}, + // }, + // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ + // AdminUsername: to.Ptr("localadmin"), + // ComputerName: to.Ptr("luamaster"), + // }, + // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), + // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ + // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ + // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), + // }, + // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), + // }, + // }, + // }}, + // } + } +}