diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md b/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md index c40d6c19337c..9dcba86e8d44 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md @@ -1,5 +1,271 @@ # Release History +## 2.0.0-beta.1 (2023-08-05) +### Breaking Changes + +- `StatusConnectedRecently`, `StatusDisconnected`, `StatusError`, `StatusNotConnectedRecently`, `StatusNotYetRegistered` from enum `Status` has been removed +- Enum `ActionType` 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 `Origin` 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 `*ClientFactory.NewOperationsClient` 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 +- Function `NewOperationsClient` has been removed +- Function `*OperationsClient.List` has been removed +- 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 `Operation` has been removed +- Struct `OperationDisplay` has been removed +- Struct `OperationListResult` 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 `NetworkTypeEnum` with values `NetworkTypeEnumICS`, `NetworkTypeEnumInternal`, `NetworkTypeEnumL2Bridge`, `NetworkTypeEnumL2Tunnel`, `NetworkTypeEnumMirrored`, `NetworkTypeEnumNAT`, `NetworkTypeEnumOverlay`, `NetworkTypeEnumPrivate`, `NetworkTypeEnumTransparent` +- 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.NewMarketplaceGalleryImagesClient() *MarketplaceGalleryImagesClient` +- New function `*ClientFactory.NewNetworkInterfacesClient() *NetworkInterfacesClient` +- New function `*ClientFactory.NewStorageContainersClient() *StorageContainersClient` +- New function `*ClientFactory.NewVirtualHardDisksClient() *VirtualHardDisksClient` +- New function `*ClientFactory.NewVirtualMachineInstancesClient() *VirtualMachineInstancesClient` +- New function `*ClientFactory.NewVirtualNetworksClient() *VirtualNetworksClient` +- 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 `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 `NewVirtualNetworksClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VirtualNetworksClient, error)` +- New function `*VirtualNetworksClient.BeginCreateOrUpdate(context.Context, string, string, VirtualNetworks, *VirtualNetworksClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworksClientCreateOrUpdateResponse], error)` +- New function `*VirtualNetworksClient.BeginDelete(context.Context, string, string, *VirtualNetworksClientBeginDeleteOptions) (*runtime.Poller[VirtualNetworksClientDeleteResponse], error)` +- New function `*VirtualNetworksClient.Get(context.Context, string, string, *VirtualNetworksClientGetOptions) (VirtualNetworksClientGetResponse, error)` +- New function `*VirtualNetworksClient.NewListAllPager(*VirtualNetworksClientListAllOptions) *runtime.Pager[VirtualNetworksClientListAllResponse]` +- New function `*VirtualNetworksClient.NewListPager(string, *VirtualNetworksClientListOptions) *runtime.Pager[VirtualNetworksClientListResponse]` +- New function `*VirtualNetworksClient.BeginUpdate(context.Context, string, string, VirtualNetworksUpdateRequest, *VirtualNetworksClientBeginUpdateOptions) (*runtime.Poller[VirtualNetworksClientUpdateResponse], 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 `Components3Iu67JSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetableProperties` +- New struct `ComponentsCr63WSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesIPConfigurationreferencesItems` +- New struct `ComponentsI4F0MhSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetable` +- New struct `ExtendedLocation` +- New struct `GalleryDiskImage` +- 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 `Identity` +- New struct `InstanceViewStatus` +- New struct `InterfaceDNSSettings` +- 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 `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 `VirtualHardDiskProperties` +- New struct `VirtualHardDiskStatus` +- New struct `VirtualHardDiskStatusProvisioningStatus` +- New struct `VirtualHardDisks` +- New struct `VirtualHardDisksListResult` +- New struct `VirtualHardDisksUpdateRequest` +- 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` +- New struct `VirtualMachineVMConfigAgentInstanceView` +- New struct `VirtualNetworkProperties` +- New struct `VirtualNetworkPropertiesDhcpOptions` +- New struct `VirtualNetworkPropertiesSubnetsItem` +- New struct `VirtualNetworkPropertiesSubnetsItemAutoGenerated` +- New struct `VirtualNetworkPropertiesSubnetsItemRouteTableRoutesItem` +- New struct `VirtualNetworkPropertiesSubnetsPropertiesItemsItem` +- New struct `VirtualNetworkStatus` +- New struct `VirtualNetworkStatusProvisioningStatus` +- New struct `VirtualNetworks` +- New struct `VirtualNetworksListResult` +- New struct `VirtualNetworksUpdateRequest` +- New field `SystemData` in struct `ProxyResource` +- New field `SystemData` in struct `Resource` +- New field `SystemData` in struct `TrackedResource` + + ## 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..11afb85045c5 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 +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurestackhci/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/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 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/client_factory.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/client_factory.go index 67a132004c3f..3a1f2f0b7394 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,22 +37,52 @@ 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) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient { + subClient, _ := NewHybridIdentityMetadataClient(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 +} + +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 +} + +func (c *ClientFactory) NewVirtualNetworksClient() *VirtualNetworksClient { + subClient, _ := NewVirtualNetworksClient(c.subscriptionID, 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..ca49c249eed7 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go @@ -3,70 +3,29 @@ // 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. -type ActionType string +// CloudInitDataSource - Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] +type CloudInitDataSource string const ( - ActionTypeInternal ActionType = "Internal" + CloudInitDataSourceAzure CloudInitDataSource = "Azure" + CloudInitDataSourceNoCloud CloudInitDataSource = "NoCloud" ) -// PossibleActionTypeValues returns the possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ - ActionTypeInternal, - } -} - -// ArcSettingAggregateState - Aggregate state of Arc agent across the nodes in this HCI cluster. -type ArcSettingAggregateState 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" -) - -// 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,229 +49,306 @@ 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 ( + DiskFileFormatVhd DiskFileFormat = "vhd" + DiskFileFormatVhdx DiskFileFormat = "vhdx" +) + +// PossibleDiskFileFormatValues returns the possible values for the DiskFileFormat const type. +func PossibleDiskFileFormatValues() []DiskFileFormat { + return []DiskFileFormat{ + DiskFileFormatVhd, + DiskFileFormatVhdx, + } +} + +// ExtendedLocationTypes - The type of extendedLocation. +type ExtendedLocationTypes string + +const ( + ExtendedLocationTypesCustomLocation ExtendedLocationTypes = "CustomLocation" +) + +// PossibleExtendedLocationTypesValues returns the possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ + ExtendedLocationTypesCustomLocation, + } +} + +// HyperVGeneration - The hypervisor generation of the Virtual Machine [V1, V2] +type HyperVGeneration string const ( - DiagnosticLevelBasic DiagnosticLevel = "Basic" - DiagnosticLevelEnhanced DiagnosticLevel = "Enhanced" - DiagnosticLevelOff DiagnosticLevel = "Off" + HyperVGenerationV1 HyperVGeneration = "V1" + HyperVGenerationV2 HyperVGeneration = "V2" ) -// PossibleDiagnosticLevelValues returns the possible values for the DiagnosticLevel const type. -func PossibleDiagnosticLevelValues() []DiagnosticLevel { - return []DiagnosticLevel{ - DiagnosticLevelBasic, - DiagnosticLevelEnhanced, - DiagnosticLevelOff, +// PossibleHyperVGenerationValues returns the possible values for the HyperVGeneration const type. +func PossibleHyperVGenerationValues() []HyperVGeneration { + return []HyperVGeneration{ + HyperVGenerationV1, + HyperVGenerationV2, } } -// ExtensionAggregateState - Aggregate state of Arc Extensions across the nodes in this HCI cluster. -type ExtensionAggregateState string +// IPAllocationMethodEnum - IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' +type IPAllocationMethodEnum 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" + IPAllocationMethodEnumDynamic IPAllocationMethodEnum = "Dynamic" + IPAllocationMethodEnumStatic IPAllocationMethodEnum = "Static" ) -// 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, +// PossibleIPAllocationMethodEnumValues returns the possible values for the IPAllocationMethodEnum const type. +func PossibleIPAllocationMethodEnumValues() []IPAllocationMethodEnum { + return []IPAllocationMethodEnum{ + IPAllocationMethodEnumDynamic, + IPAllocationMethodEnumStatic, } } -// ImdsAttestation - IMDS attestation status of the cluster. -type ImdsAttestation string +// NetworkTypeEnum - Type of the network +type NetworkTypeEnum string const ( - ImdsAttestationDisabled ImdsAttestation = "Disabled" - ImdsAttestationEnabled ImdsAttestation = "Enabled" + NetworkTypeEnumICS NetworkTypeEnum = "ICS" + NetworkTypeEnumInternal NetworkTypeEnum = "Internal" + NetworkTypeEnumL2Bridge NetworkTypeEnum = "L2Bridge" + NetworkTypeEnumL2Tunnel NetworkTypeEnum = "L2Tunnel" + NetworkTypeEnumMirrored NetworkTypeEnum = "Mirrored" + NetworkTypeEnumNAT NetworkTypeEnum = "NAT" + NetworkTypeEnumOverlay NetworkTypeEnum = "Overlay" + NetworkTypeEnumPrivate NetworkTypeEnum = "Private" + NetworkTypeEnumTransparent NetworkTypeEnum = "Transparent" ) -// PossibleImdsAttestationValues returns the possible values for the ImdsAttestation const type. -func PossibleImdsAttestationValues() []ImdsAttestation { - return []ImdsAttestation{ - ImdsAttestationDisabled, - ImdsAttestationEnabled, +// PossibleNetworkTypeEnumValues returns the possible values for the NetworkTypeEnum const type. +func PossibleNetworkTypeEnumValues() []NetworkTypeEnum { + return []NetworkTypeEnum{ + NetworkTypeEnumICS, + NetworkTypeEnumInternal, + NetworkTypeEnumL2Bridge, + NetworkTypeEnumL2Tunnel, + NetworkTypeEnumMirrored, + NetworkTypeEnumNAT, + NetworkTypeEnumOverlay, + NetworkTypeEnumPrivate, + NetworkTypeEnumTransparent, } } -// NodeArcState - State of Arc agent in this node. -type NodeArcState string +// OperatingSystemTypes - Operating system type that the gallery image uses [Windows, Linux] +type OperatingSystemTypes 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" + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" ) -// 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, +// PossibleOperatingSystemTypesValues returns the possible values for the OperatingSystemTypes const type. +func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { + return []OperatingSystemTypes{ + OperatingSystemTypesLinux, + OperatingSystemTypesWindows, } } -// NodeExtensionState - State of Arc Extension in this node. -type NodeExtensionState string +// PowerStateEnum - The power state of the virtual machine instance +type PowerStateEnum 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" + PowerStateEnumDeallocated PowerStateEnum = "Deallocated" + PowerStateEnumDeallocating PowerStateEnum = "Deallocating" + PowerStateEnumRunning PowerStateEnum = "Running" + PowerStateEnumStarting PowerStateEnum = "Starting" + PowerStateEnumStopped PowerStateEnum = "Stopped" + PowerStateEnumStopping PowerStateEnum = "Stopping" + PowerStateEnumUnknown PowerStateEnum = "Unknown" ) -// 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, +// PossiblePowerStateEnumValues returns the possible values for the PowerStateEnum const type. +func PossiblePowerStateEnumValues() []PowerStateEnum { + return []PowerStateEnum{ + PowerStateEnumDeallocated, + PowerStateEnumDeallocating, + PowerStateEnumRunning, + PowerStateEnumStarting, + PowerStateEnumStopped, + PowerStateEnumStopping, + PowerStateEnumUnknown, } } -// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default -// value is "user,system" -type Origin string +// ProvisioningAction - Defines the different types of operations for guest agent. +type ProvisioningAction string const ( - OriginSystem Origin = "system" - OriginUser Origin = "user" - OriginUserSystem Origin = "user,system" + ProvisioningActionInstall ProvisioningAction = "install" + ProvisioningActionRepair ProvisioningAction = "repair" + ProvisioningActionUninstall ProvisioningAction = "uninstall" ) -// PossibleOriginValues returns the possible values for the Origin const type. -func PossibleOriginValues() []Origin { - return []Origin{ - OriginSystem, - OriginUser, - OriginUserSystem, +// PossibleProvisioningActionValues returns the possible values for the ProvisioningAction const type. +func PossibleProvisioningActionValues() []ProvisioningAction { + return []ProvisioningAction{ + ProvisioningActionInstall, + ProvisioningActionRepair, + ProvisioningActionUninstall, } } -// ProvisioningState - Provisioning state of the ArcSetting proxy resource. -type ProvisioningState string +// 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..393a4d2c2a62 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client.go @@ -0,0 +1,446 @@ +//go:build go1.18 +// +build 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-07-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-07-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-07-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-07-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-07-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.StatusOK, 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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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[GalleryImagesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + 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-07-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-07-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/go.mod b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod index aaebf13316f1..a1d22eec9b18 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod @@ -1,21 +1,13 @@ -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 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client.go new file mode 100644 index 000000000000..2afab18f2015 --- /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-07-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-07-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-07-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-07-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-07-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.StatusOK, 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-07-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-07-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-07-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/guestagents_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client.go new file mode 100644 index 000000000000..ab9689ad4a30 --- /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-07-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-07-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/hybrididentitymetadata_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client.go new file mode 100644 index 000000000000..ade12761de0b --- /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-07-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-07-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-07-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-07-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/marketplacegalleryimages_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client.go new file mode 100644 index 000000000000..919aa8110b39 --- /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-07-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-07-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-07-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-07-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-07-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.StatusOK, 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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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/models.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go index 722e8d71fe48..a9e42ea0d30c 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go @@ -3,151 +3,194 @@ // 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 +// Components3Iu67JSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetableProperties - RouteTablePropertiesFormat +// route Table resource. +type Components3Iu67JSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetableProperties struct { + // Routes - Collection of routes contained within a route table. + Routes []*VirtualNetworkPropertiesSubnetsPropertiesItemsItem } -// ArcIdentityResponse - ArcIdentity details. -type ArcIdentityResponse struct { - // READ-ONLY; ArcIdentity properties. - Properties *ArcIdentityResponseProperties -} - -type ArcIdentityResponseProperties struct { - ArcApplicationClientID *string - ArcApplicationObjectID *string - ArcApplicationTenantID *string - ArcServicePrincipalObjectID *string +// ComponentsCr63WSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesIPConfigurationreferencesItems - IPConfigurationReference +// - Describes a IPConfiguration under the virtual network +type ComponentsCr63WSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesIPConfigurationreferencesItems struct { + // IPConfigurationID + ID *string } -// ArcSetting details. -type ArcSetting struct { - // ArcSetting properties. - Properties *ArcSettingProperties - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// ComponentsI4F0MhSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetable - RouteTable for the subnet +type ComponentsI4F0MhSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetable struct { + // Etag - Gets a unique read-only string that changes whenever the resource is updated. ID *string - // READ-ONLY; The name of the resource + // Name - READ-ONLY; Resource name. Name *string - // READ-ONLY; System data of ArcSetting resource - SystemData *SystemData + // RouteTablePropertiesFormat route Table resource. + Properties *Components3Iu67JSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetableProperties - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + // Type - READ-ONLY; Resource type. Type *string } -// ArcSettingList - List of ArcSetting proxy resources for the HCI cluster. -type ArcSettingList struct { - // READ-ONLY; Link to the next set of results. - NextLink *string +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any - // READ-ONLY; List of ArcSetting proxy resources. - Value []*ArcSetting + // READ-ONLY; The additional info type. + Type *string } -// ArcSettingProperties - ArcSetting properties. -type ArcSettingProperties struct { - // App id of arc AAD identity. - ArcApplicationClientID *string - - // Object id of arc AAD identity. - ArcApplicationObjectID *string +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo - // Tenant id of arc AAD identity. - ArcApplicationTenantID *string + // READ-ONLY; The error code. + Code *string - // The resource group that hosts the Arc agents, ie. Hybrid Compute Machine resources. - ArcInstanceResourceGroup *string + // READ-ONLY; The error details. + Details []*ErrorDetail - // Object id of arc AAD service principal. - ArcServicePrincipalObjectID *string + // READ-ONLY; The error message. + Message *string - // contains connectivity related configuration for ARC resources - ConnectivityProperties any + // READ-ONLY; The error target. + Target *string +} - // READ-ONLY; Aggregate state of Arc agent across the nodes in this HCI cluster. - AggregateState *ArcSettingAggregateState +// 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 +} - // READ-ONLY; State of Arc agent in each of the nodes. - PerNodeDetails []*PerNodeState +// ExtendedLocation - The complex type of the extended location. +type ExtendedLocation struct { + // The name of the extended location. + Name *string - // READ-ONLY; Provisioning state of the ArcSetting proxy resource. - ProvisioningState *ProvisioningState + // The type of the extended location. + Type *ExtendedLocationTypes } -// ArcSettingsClientBeginCreateIdentityOptions contains the optional parameters for the ArcSettingsClient.BeginCreateIdentity -// method. -type ArcSettingsClientBeginCreateIdentityOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// GalleryDiskImage - This is the disk image base class. +type GalleryDiskImage struct { + // READ-ONLY; This property indicates the size of the VHD to be created. + SizeInMB *int64 } -// ArcSettingsClientBeginDeleteOptions contains the optional parameters for the ArcSettingsClient.BeginDelete method. -type ArcSettingsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} +// GalleryImageIdentifier - This is the gallery image definition identifier. +type GalleryImageIdentifier struct { + // REQUIRED; The name of the gallery image definition offer. + Offer *string -// ArcSettingsClientCreateOptions contains the optional parameters for the ArcSettingsClient.Create method. -type ArcSettingsClientCreateOptions struct { - // placeholder for future optional parameters + // REQUIRED; The name of the gallery image definition publisher. + Publisher *string + + // REQUIRED; The name of the gallery image definition SKU. + SKU *string } -// ArcSettingsClientGeneratePasswordOptions contains the optional parameters for the ArcSettingsClient.GeneratePassword method. -type ArcSettingsClientGeneratePasswordOptions struct { - // placeholder for future optional parameters +// GalleryImageProperties - Properties under the gallery image resource +type GalleryImageProperties struct { + // REQUIRED; Operating system type that the gallery image uses [Windows, Linux] + OSType *OperatingSystemTypes + + // Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + CloudInitDataSource *CloudInitDataSource + + // Storage ContainerID of the storage container to be used for gallery image + ContainerID *string + + // The hypervisor generation of the Virtual Machine [V1, V2] + HyperVGeneration *HyperVGeneration + + // This is the gallery image definition identifier. + Identifier *GalleryImageIdentifier + + // location of the image the gallery image should be created from + ImagePath *string + + // Specifies information about the gallery image version that you want to create or update. + Version *GalleryImageVersion + + // READ-ONLY; Provisioning state of the gallery image. + ProvisioningState *ProvisioningStateEnum + + // READ-ONLY; The observed state of gallery images + Status *GalleryImageStatus } -// ArcSettingsClientGetOptions contains the optional parameters for the ArcSettingsClient.Get method. -type ArcSettingsClientGetOptions struct { - // placeholder for future optional parameters +// GalleryImageStatus - The observed state of gallery images +type GalleryImageStatus struct { + // The download status of the gallery image + DownloadStatus *GalleryImageStatusDownloadStatus + + // GalleryImage provisioning error code + ErrorCode *string + + // Descriptive error message + ErrorMessage *string + + // The progress of the operation in percentage + ProgressPercentage *int64 + ProvisioningStatus *GalleryImageStatusProvisioningStatus } -// ArcSettingsClientListByClusterOptions contains the optional parameters for the ArcSettingsClient.NewListByClusterPager -// method. -type ArcSettingsClientListByClusterOptions 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 } -// ArcSettingsClientUpdateOptions contains the optional parameters for the ArcSettingsClient.Update method. -type ArcSettingsClientUpdateOptions struct { - // placeholder for future optional parameters +type GalleryImageStatusProvisioningStatus 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 } -// 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 +} + +// 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 } -// ArcSettingsPatchProperties - ArcSettings properties. -type ArcSettingsPatchProperties struct { - // contains connectivity related configuration for ARC resources - ConnectivityProperties any +// GalleryImageVersionStorageProfile - This is the storage profile of a Gallery Image Version. +type GalleryImageVersionStorageProfile struct { + // This is the OS disk image. + OSDiskImage *GalleryOSDiskImage } -// Cluster details. -type Cluster struct { +// 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 +201,298 @@ 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 -} - -// ClusterIdentityResponse - Cluster Identity details. -type ClusterIdentityResponse struct { - // READ-ONLY; Cluster identity properties. - Properties *ClusterIdentityResponseProperties + // READ-ONLY; Link to the next set of results. + NextLink *string } -type ClusterIdentityResponseProperties struct { - AADApplicationObjectID *string - AADClientID *string - AADServicePrincipalObjectID *string - AADTenantID *string +// GalleryImagesUpdateRequest - The gallery images resource patch definition. +type GalleryImagesUpdateRequest struct { + // Resource tags + Tags map[string]*string } -// ClusterList - List of clusters. -type ClusterList struct { - // List of clusters. - Value []*Cluster - - // READ-ONLY; Link to the next set of results. - NextLink *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 } -// ClusterNode - Cluster node details. -type ClusterNode struct { - // READ-ONLY; Number of physical cores on the cluster node. - CoreCount *float32 +// GuestAgent - Defines the GuestAgent. +type GuestAgent struct { + // REQUIRED; Resource properties. + Properties *GuestAgentProperties - // READ-ONLY; Id of the node in the cluster. - ID *float32 + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; Manufacturer of the cluster node hardware. - Manufacturer *string + // READ-ONLY; The name of the resource + Name *string - // READ-ONLY; Total available memory on the cluster node (in GiB). - MemoryInGiB *float32 + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Model name of the cluster node hardware. - Model *string + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} - // READ-ONLY; Name of the cluster node. - Name *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; Operating system running on the cluster node. - OSName *string + // READ-ONLY; Details about the error state. + ErrorDetails []*ErrorDetail - // READ-ONLY; Version of the operating system running on the cluster node. - OSVersion *string + // READ-ONLY; The time of the last status change. + LastStatusChange *time.Time - // READ-ONLY; Immutable id of the cluster node. - SerialNumber *string + // READ-ONLY; The installation status of the hybrid machine agent installation. + Status *StatusTypes - // READ-ONLY; State of Windows Server Subscription. - WindowsServerSubscription *WindowsServerSubscription + // READ-ONLY; Specifies the VM's unique SMBIOS ID. + VMUUID *string } -// ClusterPatch - Cluster details to update. -type ClusterPatch struct { - // Cluster properties. - Properties *ClusterPatchProperties +// GuestAgentList - List of GuestAgent. +type GuestAgentList struct { + // REQUIRED; Array of GuestAgent + Value []*GuestAgent - // Resource tags. - Tags map[string]*string + // Url to follow for getting next page of GuestAgent. + NextLink *string } -// ClusterPatchProperties - Cluster properties. -type ClusterPatchProperties struct { - // App id of cluster AAD identity. - AADClientID *string +// GuestAgentProperties - Defines the resource properties. +type GuestAgentProperties struct { + // Username / Password Credentials to provision guest agent. + Credentials *GuestCredential - // Tenant id of cluster AAD identity. - AADTenantID *string + // HTTP Proxy configuration for the VM. + HTTPProxyConfig *HTTPProxyConfiguration - // Endpoint configured for management from the Azure portal - CloudManagementEndpoint *string + // The guest agent provisioning action. + ProvisioningAction *ProvisioningAction - // Desired properties of the cluster. - DesiredProperties *ClusterDesiredProperties + // READ-ONLY; The provisioning state. + ProvisioningState *string + + // READ-ONLY; The guest agent status. + Status *string } -// ClusterProperties - Cluster properties. -type ClusterProperties struct { - // Object id of cluster AAD identity. - AADApplicationObjectID *string +// GuestCredential - Username / Password Credentials to connect to guest. +type GuestCredential struct { + // The password to connect with the guest. + Password *string - // App id of cluster AAD identity. - AADClientID *string + // The username to connect with the guest. + Username *string +} - // Id of cluster identity service principal. - AADServicePrincipalObjectID *string +// HTTPProxyConfiguration - HTTP Proxy configuration for the VM. +type HTTPProxyConfiguration struct { + // The httpsProxy url. + HTTPSProxy *string +} - // Tenant id of cluster AAD identity. - AADTenantID *string +// HardwareProfileUpdate - HardwareProfile - Specifies the hardware settings for the virtual machine instance. +type HardwareProfileUpdate struct { + // RAM in MB for the virtual machine instance + MemoryMB *int64 - // Endpoint configured for management from the Azure portal. - CloudManagementEndpoint *string + // number of processors for the virtual machine instance + Processors *int32 + VMSize *VMSizeEnum +} - // Desired properties of the cluster. - DesiredProperties *ClusterDesiredProperties +// HybridIdentityMetadata - Defines the HybridIdentityMetadata. +type HybridIdentityMetadata struct { + // REQUIRED; Resource properties. + Properties *HybridIdentityMetadataProperties - // READ-ONLY; Type of billing applied to the resource. - BillingModel *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; Unique, immutable resource id. - CloudID *string + // READ-ONLY; The name of the resource + Name *string - // READ-ONLY; Most recent billing meter timestamp. - LastBillingTimestamp *time.Time + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Most recent cluster sync timestamp. - LastSyncTimestamp *time.Time + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} - // READ-ONLY; Provisioning state. - ProvisioningState *ProvisioningState +// HybridIdentityMetadataList - List of HybridIdentityMetadata. +type HybridIdentityMetadataList struct { + // REQUIRED; Array of HybridIdentityMetadata + Value []*HybridIdentityMetadata - // READ-ONLY; First cluster sync timestamp. - RegistrationTimestamp *time.Time + // Url to follow for getting next page of HybridIdentityMetadata. + NextLink *string +} - // READ-ONLY; Properties reported by cluster agent. - ReportedProperties *ClusterReportedProperties +// HybridIdentityMetadataProperties - Defines the resource properties. +type HybridIdentityMetadataProperties struct { + // The Public Key. + PublicKey *string - // READ-ONLY; Region specific DataPath Endpoint of the cluster. - ServiceEndpoint *string + // The unique identifier for the resource. + ResourceUID *string - // READ-ONLY; Status of the cluster agent. - Status *Status + // READ-ONLY; Identity for the resource. + Identity *Identity - // READ-ONLY; Number of days remaining in the trial period. - TrialDaysRemaining *float32 + // READ-ONLY; The provisioning state. + ProvisioningState *string } -// ClusterReportedProperties - Properties reported by cluster agent. -type ClusterReportedProperties struct { - // Level of diagnostic data emitted by the cluster. - DiagnosticLevel *DiagnosticLevel - - // READ-ONLY; Unique id generated by the on-prem cluster. - ClusterID *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; Name of the on-prem cluster connected to this resource. - ClusterName *string + // InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + Properties *IPConfigurationProperties +} - // READ-ONLY; Version of the cluster software. - ClusterVersion *string +// IPConfigurationProperties - InterfaceIPConfigurationPropertiesFormat properties of IP configuration. +type IPConfigurationProperties struct { + // Gateway for network interface + Gateway *string - // READ-ONLY; IMDS attestation status of the cluster. - ImdsAttestation *ImdsAttestation + // prefixLength for network interface + PrefixLength *string - // READ-ONLY; Last time the cluster reported the data. - LastUpdated *time.Time + // PrivateIPAddress - Private IP address of the IP configuration. + PrivateIPAddress *string - // READ-ONLY; List of nodes reported by the cluster. - Nodes []*ClusterNode + // Subnet - Name of Subnet bound to the IP configuration. + Subnet *IPConfigurationPropertiesSubnet } -// ClustersClientBeginCreateIdentityOptions contains the optional parameters for the ClustersClient.BeginCreateIdentity method. -type ClustersClientBeginCreateIdentityOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// 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 } -// ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. -type ClustersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} +// Identity for the resource. +type Identity struct { + // The identity type. + Type *string -// ClustersClientBeginUploadCertificateOptions contains the optional parameters for the ClustersClient.BeginUploadCertificate -// method. -type ClustersClientBeginUploadCertificateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string -// ClustersClientCreateOptions contains the optional parameters for the ClustersClient.Create method. -type ClustersClientCreateOptions struct { - // placeholder for future optional parameters + // READ-ONLY; The tenant ID of resource. + TenantID *string } -// ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. -type ClustersClientGetOptions struct { - // placeholder for future optional parameters -} +// InstanceViewStatus - Instance view status. +type InstanceViewStatus struct { + // The status code. + Code *string -// ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager -// method. -type ClustersClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} + // The short localizable label for the status. + DisplayStatus *string + + // The level code. + Level *StatusLevelTypes + + // The detailed status message, including for alerts and error messages. + Message *string -// ClustersClientListBySubscriptionOptions contains the optional parameters for the ClustersClient.NewListBySubscriptionPager -// method. -type ClustersClientListBySubscriptionOptions struct { - // placeholder for future optional parameters + // The time of the status. + Time *time.Time } -// ClustersClientUpdateOptions contains the optional parameters for the ClustersClient.Update method. -type ClustersClientUpdateOptions struct { - // placeholder for future optional parameters +type InterfaceDNSSettings struct { + // List of DNS server IP Addresses for the interface + DNSServers []*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,204 +500,266 @@ 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 - // READ-ONLY; Aggregate state of Arc Extensions across the nodes in this HCI cluster. - AggregateState *ExtensionAggregateState + // The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + Status *Status +} - // READ-ONLY; State of Arc Extension in each of the nodes. - PerNodeExtensionDetails []*PerNodeExtensionState +// NetworkInterfaces - The network interface resource definition. +type NetworkInterfaces struct { + // REQUIRED; The geo-location where the resource lives + Location *string - // READ-ONLY; Provisioning state of the Extension proxy resource. - ProvisioningState *ProvisioningState -} + // The extendedLocation of the resource. + ExtendedLocation *ExtendedLocation + + // Properties under the network interface resource + Properties *NetworkInterfaceProperties + + // 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 -// ExtensionsClientBeginCreateOptions contains the optional parameters for the ExtensionsClient.BeginCreate method. -type ExtensionsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken 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 -type Operation struct { - // Localized display information for this particular operation. - Display *OperationDisplay +// OsProfileUpdate - OsProfile - describes the update configuration of the operating system +type OsProfileUpdate struct { + // ComputerName - name of the computer + ComputerName *string + LinuxConfiguration *OsProfileUpdateLinuxConfiguration + WindowsConfiguration *OsProfileUpdateWindowsConfiguration +} - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - ActionType *ActionType +type OsProfileUpdateLinuxConfiguration struct { + // Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + // process. + ProvisionVMAgent *bool - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane - // operations. - IsDataAction *bool + // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ProvisionVMConfigAgent *bool +} - // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", - // "Microsoft.Compute/virtualMachines/capture/action" - Name *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 - // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default - // value is "user,system" - Origin *Origin + // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ProvisionVMConfigAgent *bool } -// OperationDisplay - Localized display information for this particular operation. -type OperationDisplay struct { - // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. - Description *string +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location +type ProxyResource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual - // Machine", "Restart Virtual Machine". - Operation *string + // READ-ONLY; The name of the resource + Name *string - // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft - // Compute". - Provider *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job - // Schedule Collections". - Resource *string + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to -// get the next set of results. -type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; List of operations supported by the resource provider - Value []*Operation + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters +// 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 } -type PasswordCredential struct { - EndDateTime *time.Time - KeyID *string - SecretText *string - StartDateTime *time.Time +// 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 } -// 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 +// StorageContainerProperties - Properties under the storage container resource +type StorageContainerProperties struct { + // Path of the storage container on the disk + Path *string - // READ-ONLY; Name of the node in HCI Cluster. - Name *string + // READ-ONLY; Provisioning state of the storage container. + ProvisioningState *ProvisioningStateEnum - // READ-ONLY; State of Arc Extension in this node. - State *NodeExtensionState + // READ-ONLY; The observed state of storage containers + Status *StorageContainerStatus } -// 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 +// StorageContainerStatus - The observed state of storage containers +type StorageContainerStatus struct { + // Amount of space available on the disk in MB + AvailableSizeMB *int64 - // READ-ONLY; Name of the Node in HCI Cluster - Name *string + // Total size of the disk in MB + ContainerSizeMB *int64 - // READ-ONLY; State of Arc agent in this node. - State *NodeArcState + // StorageContainer provisioning error code + ErrorCode *string + + // Descriptive error message + ErrorMessage *string + ProvisioningStatus *StorageContainerStatusProvisioningStatus } -// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a -// location -type ProxyResource struct { +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} - ID *string +// StorageContainersUpdateRequest - The storage container resource patch definition. +type StorageContainersUpdateRequest struct { + // Resource tags + Tags map[string]*string +} - // READ-ONLY; The name of the resource - Name *string +type StorageProfileUpdate struct { + // adds data disks to the virtual machine instance for the update call + DataDisks []*StorageProfileUpdateDataDisksItem +} - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string +type StorageProfileUpdateDataDisksItem struct { + ID *string } // SystemData - Metadata pertaining to creation and last modification of the resource. @@ -655,10 +798,493 @@ 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 +} + +// 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 + + // 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 VirtualHardDisksListResult struct { + NextLink *string + Value []*VirtualHardDisks +} + +// VirtualHardDisksUpdateRequest - The virtual hard disk resource patch definition. +type VirtualHardDisksUpdateRequest struct { + // Resource tags + Tags map[string]*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 VirtualMachineInstanceListResult struct { + NextLink *string + Value []*VirtualMachineInstance +} + +// VirtualMachineInstanceProperties - Properties under the virtual machine instance resource +type VirtualMachineInstanceProperties struct { + // Guest agent install status. + GuestAgentInstallStatus *GuestAgentInstallStatus + + // 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 *VirtualMachineVMConfigAgentInstanceView +} + +// VirtualMachineVMConfigAgentInstanceView - The instance view of the VM Config Agent running on the virtual machine. +type VirtualMachineVMConfigAgentInstanceView struct { + // The resource status information. + Statuses []*InstanceViewStatus + + // The VM Config Agent full version. + VMConfigAgentVersion *string +} + +// VirtualNetworkProperties - Properties under the virtual network resource +type VirtualNetworkProperties struct { + // DhcpOptions contains an array of DNS servers available to VMs deployed in the virtual network. Standard DHCP option for + // a subnet overrides VNET DHCP options. + DhcpOptions *VirtualNetworkPropertiesDhcpOptions + + // Type of the network + NetworkType *NetworkTypeEnum + + // Subnet - list of subnets under the virtual network + Subnets []*VirtualNetworkPropertiesSubnetsItem + + // name of the network switch to be used for VMs + VMSwitchName *string + + // READ-ONLY; Provisioning state of the virtual network. + ProvisioningState *ProvisioningStateEnum + + // READ-ONLY; The observed state of virtual networks + Status *VirtualNetworkStatus +} + +// VirtualNetworkPropertiesDhcpOptions - DhcpOptions contains an array of DNS servers available to VMs deployed in the virtual +// network. Standard DHCP option for a subnet overrides VNET DHCP options. +type VirtualNetworkPropertiesDhcpOptions struct { + // The list of DNS servers IP addresses. + DNSServers []*string +} + +// VirtualNetworkPropertiesSubnetsItem - Subnet subnet in a virtual network resource. +type VirtualNetworkPropertiesSubnetsItem 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 + + // SubnetProperties - Properties of the subnet. + Properties *VirtualNetworkPropertiesSubnetsItemAutoGenerated +} + +// VirtualNetworkPropertiesSubnetsItemAutoGenerated - SubnetProperties - Properties of the subnet. +type VirtualNetworkPropertiesSubnetsItemAutoGenerated struct { + // Cidr for this subnet - IPv4, IPv6 + AddressPrefix *string + + // AddressPrefixes - 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 []*ComponentsCr63WSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesIPConfigurationreferencesItems + + // RouteTable for the subnet + RouteTable *ComponentsI4F0MhSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetable + + // Vlan to use for the subnet + Vlan *int32 +} + +// VirtualNetworkPropertiesSubnetsItemRouteTableRoutesItem - RoutePropertiesFormat - Properties of the route. +type VirtualNetworkPropertiesSubnetsItemRouteTableRoutesItem struct { + // AddressPrefix - The destination CIDR to which the route applies. + AddressPrefix *string + + // NextHopIPAddress - 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 +} + +// VirtualNetworkPropertiesSubnetsPropertiesItemsItem - Route is associated with a subnet. +type VirtualNetworkPropertiesSubnetsPropertiesItemsItem struct { + // Name - name of the subnet + Name *string + + // RoutePropertiesFormat - Properties of the route. + Properties *VirtualNetworkPropertiesSubnetsItemRouteTableRoutesItem +} + +// VirtualNetworkStatus - The observed state of virtual networks +type VirtualNetworkStatus struct { + // VirtualNetwork provisioning error code + ErrorCode *string + + // Descriptive error message + ErrorMessage *string + ProvisioningStatus *VirtualNetworkStatusProvisioningStatus +} + +type VirtualNetworkStatusProvisioningStatus struct { + // The ID of the operation performed on the virtual network + OperationID *string + + // The status of the operation performed on the virtual network [Succeeded, Failed, InProgress] + Status *Status +} + +// VirtualNetworks - The virtual network resource definition. +type VirtualNetworks struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The extendedLocation of the resource. + ExtendedLocation *ExtendedLocation + + // Properties under the virtual network resource + Properties *VirtualNetworkProperties + + // 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 UploadCertificateRequest struct { - Properties *RawCertificateData +type VirtualNetworksListResult struct { + NextLink *string + Value []*VirtualNetworks +} + +// VirtualNetworksUpdateRequest - The virtual network resource patch definition. +type VirtualNetworksUpdateRequest struct { + // Resource tags + Tags map[string]*string } diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go index 9ec0dc773d5d..1a05142c795c 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,3810 @@ 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 Components3Iu67JSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetableProperties. +func (c Components3Iu67JSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetableProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "routes", c.Routes) 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 Components3Iu67JSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetableProperties. +func (c *Components3Iu67JSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetableProperties) UnmarshalJSON(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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "routes": + err = unpopulate(val, "Routes", &c.Routes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComponentsCr63WSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesIPConfigurationreferencesItems. +func (c ComponentsCr63WSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesIPConfigurationreferencesItems) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComponentsCr63WSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesIPConfigurationreferencesItems. +func (c *ComponentsCr63WSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesIPConfigurationreferencesItems) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComponentsI4F0MhSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetable. +func (c ComponentsI4F0MhSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComponentsI4F0MhSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetable. +func (c *ComponentsI4F0MhSchemasVirtualnetworkpropertiesPropertiesSubnetsItemsPropertiesRoutetable) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) 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) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. +func (e ExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. +func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryDiskImage. +func (g GalleryDiskImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sizeInMB", g.SizeInMB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryDiskImage. +func (g *GalleryDiskImage) UnmarshalJSON(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 "sizeInMB": + err = unpopulate(val, "SizeInMB", &g.SizeInMB) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageIdentifier. +func (g GalleryImageIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "offer": + err = unpopulate(val, "Offer", &g.Offer) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &g.Publisher) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &g.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageProperties. +func (g GalleryImageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cloudInitDataSource": + err = unpopulate(val, "CloudInitDataSource", &g.CloudInitDataSource) + delete(rawMsg, key) + 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", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatus. +func (g GalleryImageStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "downloadStatus": + err = unpopulate(val, "DownloadStatus", &g.DownloadStatus) + delete(rawMsg, key) + case "errorCode": + err = unpopulate(val, "ErrorCode", &g.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &g.ErrorMessage) + delete(rawMsg, key) + case "progressPercentage": + err = unpopulate(val, "ProgressPercentage", &g.ProgressPercentage) + delete(rawMsg, key) + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &g.ProvisioningStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatusDownloadStatus. +func (g GalleryImageStatusDownloadStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "downloadSizeInMB", g.DownloadSizeInMB) + return json.Marshal(objectMap) +} + +// 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "downloadSizeInMB": + err = unpopulate(val, "DownloadSizeInMB", &g.DownloadSizeInMB) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatusProvisioningStatus. +func (g GalleryImageStatusProvisioningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", g.OperationID) + populate(objectMap, "status", g.Status) + return json.Marshal(objectMap) +} + +// 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersion. +func (g GalleryImageVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + return json.Marshal(objectMap) +} + +// 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionProperties. +func (g GalleryImageVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "storageProfile", g.StorageProfile) + return json.Marshal(objectMap) +} + +// 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "storageProfile": + err = unpopulate(val, "StorageProfile", &g.StorageProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionStorageProfile. +func (g GalleryImageVersionStorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "osDiskImage", g.OSDiskImage) + return json.Marshal(objectMap) +} + +// 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "osDiskImage": + err = unpopulate(val, "OSDiskImage", &g.OSDiskImage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImages. +func (g GalleryImages) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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 "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImagesListResult. +func (g GalleryImagesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImagesUpdateRequest. +func (g GalleryImagesUpdateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", g.Tags) + return json.Marshal(objectMap) +} + +// 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryOSDiskImage. +func (g GalleryOSDiskImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sizeInMB", g.SizeInMB) + return json.Marshal(objectMap) +} + +// 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sizeInMB": + err = unpopulate(val, "SizeInMB", &g.SizeInMB) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GuestAgent. +func (g GuestAgent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GuestAgentInstallStatus. +func (g GuestAgentInstallStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentVersion", g.AgentVersion) + populate(objectMap, "errorDetails", g.ErrorDetails) + populateTimeRFC3339(objectMap, "lastStatusChange", g.LastStatusChange) + populate(objectMap, "status", g.Status) + populate(objectMap, "vmUuid", g.VMUUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentVersion": + err = unpopulate(val, "AgentVersion", &g.AgentVersion) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &g.ErrorDetails) + delete(rawMsg, key) + case "lastStatusChange": + err = unpopulateTimeRFC3339(val, "LastStatusChange", &g.LastStatusChange) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &g.Status) + delete(rawMsg, key) + case "vmUuid": + err = unpopulate(val, "VMUUID", &g.VMUUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GuestAgentList. +func (g GuestAgentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GuestAgentProperties. +func (g GuestAgentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "credentials", g.Credentials) + populate(objectMap, "httpProxyConfig", g.HTTPProxyConfig) + 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 "httpProxyConfig": + err = unpopulate(val, "HTTPProxyConfig", &g.HTTPProxyConfig) + delete(rawMsg, key) + case "provisioningAction": + err = unpopulate(val, "ProvisioningAction", &g.ProvisioningAction) + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GuestCredential. +func (g GuestCredential) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "password", g.Password) + populate(objectMap, "username", g.Username) + return json.Marshal(objectMap) +} + +// 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "password": + err = unpopulate(val, "Password", &g.Password) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &g.Username) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HTTPProxyConfiguration. +func (h HTTPProxyConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "httpsProxy", h.HTTPSProxy) + return json.Marshal(objectMap) +} + +// 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "httpsProxy": + err = unpopulate(val, "HTTPSProxy", &h.HTTPSProxy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HardwareProfileUpdate. +func (h HardwareProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadata. +func (h HybridIdentityMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataList. +func (h HybridIdentityMetadataList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataList. +func (h *HybridIdentityMetadataList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataProperties. +func (h HybridIdentityMetadataProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", h.Identity) + populate(objectMap, "provisioningState", h.ProvisioningState) + populate(objectMap, "publicKey", h.PublicKey) + populate(objectMap, "resourceUid", h.ResourceUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataProperties. +func (h *HybridIdentityMetadataProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &h.Identity) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + delete(rawMsg, key) + case "publicKey": + err = unpopulate(val, "PublicKey", &h.PublicKey) + delete(rawMsg, key) + case "resourceUid": + err = unpopulate(val, "ResourceUID", &h.ResourceUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPConfiguration. +func (i IPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + return json.Marshal(objectMap) +} + +// 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + 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 IPConfigurationProperties. +func (i IPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "gateway": + err = unpopulate(val, "Gateway", &i.Gateway) + delete(rawMsg, key) + case "prefixLength": + err = unpopulate(val, "PrefixLength", &i.PrefixLength) + delete(rawMsg, key) + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &i.PrivateIPAddress) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &i.Subnet) + 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 IPConfigurationPropertiesSubnet. +func (i IPConfigurationPropertiesSubnet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + return json.Marshal(objectMap) +} + +// 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + 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 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 InstanceViewStatus. +func (i InstanceViewStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &i.Code) + delete(rawMsg, key) + case "displayStatus": + err = unpopulate(val, "DisplayStatus", &i.DisplayStatus) + delete(rawMsg, key) + case "level": + err = unpopulate(val, "Level", &i.Level) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &i.Message) + delete(rawMsg, key) + case "time": + err = unpopulateTimeRFC3339(val, "Time", &i.Time) + 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 InterfaceDNSSettings. +func (i InterfaceDNSSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsServers", i.DNSServers) + return json.Marshal(objectMap) +} + +// 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsServers": + err = unpopulate(val, "DNSServers", &i.DNSServers) + 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 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 "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", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImageStatus. +func (m MarketplaceGalleryImageStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "downloadStatus": + err = unpopulate(val, "DownloadStatus", &m.DownloadStatus) + delete(rawMsg, key) + case "errorCode": + err = unpopulate(val, "ErrorCode", &m.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &m.ErrorMessage) + delete(rawMsg, key) + case "progressPercentage": + err = unpopulate(val, "ProgressPercentage", &m.ProgressPercentage) + delete(rawMsg, key) + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &m.ProvisioningStatus) + 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 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", 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 MarketplaceGalleryImages. +func (m MarketplaceGalleryImages) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", 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", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImagesListResult. +func (m MarketplaceGalleryImagesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type 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 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 ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + 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 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 "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) + case "dataDisks": + err = unpopulate(val, "DataDisks", &s.DataDisks) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", s, 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 StorageProfileUpdateDataDisksItem. +func (s StorageProfileUpdateDataDisksItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) + populate(objectMap, "id", s.ID) 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 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", a, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", s, 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 SystemData. +func (s SystemData) 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) + 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 ArcIdentityResponseProperties. -func (a *ArcIdentityResponseProperties) UnmarshalJSON(data []byte) error { +// 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", a, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "arcApplicationClientId": - err = unpopulate(val, "ArcApplicationClientID", &a.ArcApplicationClientID) + 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 "arcApplicationObjectId": - err = unpopulate(val, "ArcApplicationObjectID", &a.ArcApplicationObjectID) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) - case "arcApplicationTenantId": - err = unpopulate(val, "ArcApplicationTenantID", &a.ArcApplicationTenantID) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) delete(rawMsg, key) - case "arcServicePrincipalObjectId": - err = unpopulate(val, "ArcServicePrincipalObjectID", &a.ArcServicePrincipalObjectID) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", s, 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 TrackedResource. +func (t TrackedResource) 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, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) 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 TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &a.ID) + err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "location": + err = unpopulate(val, "Location", &t.Location) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "name": + err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &a.Type) + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", t, 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 VirtualHardDiskProperties. +func (v VirtualHardDiskProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) + 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 ArcSettingList. -func (a *ArcSettingList) UnmarshalJSON(data []byte) error { +// 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", a, err) + 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", &a.NextLink) + case "blockSizeBytes": + err = unpopulate(val, "BlockSizeBytes", &v.BlockSizeBytes) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) + 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", a, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualHardDiskStatusProvisioningStatus. +func (v VirtualHardDiskStatusProvisioningStatus) 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, "operationId", v.OperationID) + populate(objectMap, "status", v.Status) 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 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", a, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "aggregateState": - err = unpopulate(val, "AggregateState", &a.AggregateState) + case "operationId": + err = unpopulate(val, "OperationID", &v.OperationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) delete(rawMsg, key) - case "arcApplicationClientId": - err = unpopulate(val, "ArcApplicationClientID", &a.ArcApplicationClientID) + } + 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 "arcApplicationObjectId": - err = unpopulate(val, "ArcApplicationObjectID", &a.ArcApplicationObjectID) + case "id": + err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) - case "arcApplicationTenantId": - err = unpopulate(val, "ArcApplicationTenantID", &a.ArcApplicationTenantID) + case "location": + err = unpopulate(val, "Location", &v.Location) delete(rawMsg, key) - case "arcInstanceResourceGroup": - err = unpopulate(val, "ArcInstanceResourceGroup", &a.ArcInstanceResourceGroup) + case "name": + err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) - case "arcServicePrincipalObjectId": - err = unpopulate(val, "ArcServicePrincipalObjectID", &a.ArcServicePrincipalObjectID) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) delete(rawMsg, key) - case "connectivityProperties": - err = unpopulate(val, "ConnectivityProperties", &a.ConnectivityProperties) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) delete(rawMsg, key) - case "perNodeDetails": - err = unpopulate(val, "PerNodeDetails", &a.PerNodeDetails) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + case "type": + err = unpopulate(val, "Type", &v.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualHardDisksListResult. +func (v VirtualHardDisksListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) 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 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", a, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "value": + err = unpopulate(val, "Value", &v.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualHardDisksUpdateRequest. +func (v VirtualHardDisksUpdateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "connectivityProperties", a.ConnectivityProperties) + populate(objectMap, "tags", v.Tags) 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 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", a, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "connectivityProperties": - err = unpopulate(val, "ConnectivityProperties", &a.ConnectivityProperties) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstance. +func (v VirtualMachineInstance) 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, "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 Cluster. -func (c *Cluster) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstance. +func (v *VirtualMachineInstance) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + 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", &c.ID) + err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &c.Location) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &c.Name) + err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &c.Properties) + err = unpopulate(val, "Properties", &v.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &c.Tags) + err = unpopulate(val, "SystemData", &v.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &c.Type) + err = unpopulate(val, "Type", &v.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstanceListResult. +func (v VirtualMachineInstanceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "diagnosticLevel", c.DiagnosticLevel) - populate(objectMap, "windowsServerSubscription", c.WindowsServerSubscription) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) 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 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "diagnosticLevel": - err = unpopulate(val, "DiagnosticLevel", &c.DiagnosticLevel) + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) delete(rawMsg, key) - case "windowsServerSubscription": - err = unpopulate(val, "WindowsServerSubscription", &c.WindowsServerSubscription) + case "value": + err = unpopulate(val, "Value", &v.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstanceProperties. +func (v VirtualMachineInstanceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", c.Properties) + populate(objectMap, "guestAgentInstallStatus", v.GuestAgentInstallStatus) + 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 ClusterIdentityResponse. -func (c *ClusterIdentityResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstanceProperties. +func (v *VirtualMachineInstanceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "guestAgentInstallStatus": + err = unpopulate(val, "GuestAgentInstallStatus", &v.GuestAgentInstallStatus) + 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstancePropertiesHardwareProfile. +func (v VirtualMachineInstancePropertiesHardwareProfile) 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, "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 ClusterIdentityResponseProperties. -func (c *ClusterIdentityResponseProperties) UnmarshalJSON(data []byte) error { +// 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "aadApplicationObjectId": - err = unpopulate(val, "AADApplicationObjectID", &c.AADApplicationObjectID) + case "dynamicMemoryConfig": + err = unpopulate(val, "DynamicMemoryConfig", &v.DynamicMemoryConfig) delete(rawMsg, key) - case "aadClientId": - err = unpopulate(val, "AADClientID", &c.AADClientID) + case "memoryMB": + err = unpopulate(val, "MemoryMB", &v.MemoryMB) delete(rawMsg, key) - case "aadServicePrincipalObjectId": - err = unpopulate(val, "AADServicePrincipalObjectID", &c.AADServicePrincipalObjectID) + case "processors": + err = unpopulate(val, "Processors", &v.Processors) delete(rawMsg, key) - case "aadTenantId": - err = unpopulate(val, "AADTenantID", &c.AADTenantID) + case "vmSize": + err = unpopulate(val, "VMSize", &v.VMSize) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig. +func (v VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + 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 ClusterList. -func (c *ClusterList) UnmarshalJSON(data []byte) error { +// 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", c, err) + 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", &c.NextLink) + case "maximumMemoryMB": + err = unpopulate(val, "MaximumMemoryMB", &v.MaximumMemoryMB) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstancePropertiesNetworkProfile. +func (v VirtualMachineInstancePropertiesNetworkProfile) 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, "networkInterfaces", v.NetworkInterfaces) 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 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "coreCount": - err = unpopulate(val, "CoreCount", &c.CoreCount) + 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", &c.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 "manufacturer": - err = unpopulate(val, "Manufacturer", &c.Manufacturer) + case "adminUsername": + err = unpopulate(val, "AdminUsername", &v.AdminUsername) delete(rawMsg, key) - case "memoryInGiB": - err = unpopulate(val, "MemoryInGiB", &c.MemoryInGiB) + case "computerName": + err = unpopulate(val, "ComputerName", &v.ComputerName) delete(rawMsg, key) - case "model": - err = unpopulate(val, "Model", &c.Model) + case "linuxConfiguration": + err = unpopulate(val, "LinuxConfiguration", &v.LinuxConfiguration) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) + 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 "osName": - err = unpopulate(val, "OSName", &c.OSName) + case "provisionVMAgent": + err = unpopulate(val, "ProvisionVMAgent", &v.ProvisionVMAgent) delete(rawMsg, key) - case "osVersion": - err = unpopulate(val, "OSVersion", &c.OSVersion) + case "provisionVMConfigAgent": + err = unpopulate(val, "ProvisionVMConfigAgent", &v.ProvisionVMConfigAgent) delete(rawMsg, key) - case "serialNumber": - err = unpopulate(val, "SerialNumber", &c.SerialNumber) + case "ssh": + err = unpopulate(val, "SSH", &v.SSH) delete(rawMsg, key) - case "windowsServerSubscription": - err = unpopulate(val, "WindowsServerSubscription", &c.WindowsServerSubscription) + case "timeZone": + err = unpopulate(val, "TimeZone", &v.TimeZone) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstancePropertiesSecurityProfile. +func (v VirtualMachineInstancePropertiesSecurityProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "tags", c.Tags) + 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 ClusterPatch. -func (c *ClusterPatch) UnmarshalJSON(data []byte) error { +// 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "enableTPM": + err = unpopulate(val, "EnableTPM", &v.EnableTPM) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &c.Tags) + 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstancePropertiesSecurityProfileUefiSettings. +func (v VirtualMachineInstancePropertiesSecurityProfileUefiSettings) 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, "secureBootEnabled", v.SecureBootEnabled) 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 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "aadClientId": - err = unpopulate(val, "AADClientID", &c.AADClientID) - delete(rawMsg, key) - case "aadTenantId": - err = unpopulate(val, "AADTenantID", &c.AADTenantID) - delete(rawMsg, key) - case "cloudManagementEndpoint": - err = unpopulate(val, "CloudManagementEndpoint", &c.CloudManagementEndpoint) - delete(rawMsg, key) - case "desiredProperties": - err = unpopulate(val, "DesiredProperties", &c.DesiredProperties) + case "secureBootEnabled": + err = unpopulate(val, "SecureBootEnabled", &v.SecureBootEnabled) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstancePropertiesStorageProfile. +func (v VirtualMachineInstancePropertiesStorageProfile) 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, "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 ClusterProperties. -func (c *ClusterProperties) UnmarshalJSON(data []byte) error { +// 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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) - delete(rawMsg, key) - case "desiredProperties": - err = unpopulate(val, "DesiredProperties", &c.DesiredProperties) - delete(rawMsg, key) - case "lastBillingTimestamp": - err = unpopulateTimeRFC3339(val, "LastBillingTimestamp", &c.LastBillingTimestamp) - delete(rawMsg, key) - case "lastSyncTimestamp": - err = unpopulateTimeRFC3339(val, "LastSyncTimestamp", &c.LastSyncTimestamp) + case "dataDisks": + err = unpopulate(val, "DataDisks", &v.DataDisks) 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 "imageReference": + err = unpopulate(val, "ImageReference", &v.ImageReference) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &c.Status) + case "osDisk": + err = unpopulate(val, "OSDisk", &v.OSDisk) delete(rawMsg, key) - case "trialDaysRemaining": - err = unpopulate(val, "TrialDaysRemaining", &c.TrialDaysRemaining) + case "vmConfigStoragePathId": + err = unpopulate(val, "VMConfigStoragePathID", &v.VMConfigStoragePathID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstancePropertiesStorageProfileDataDisksItem. +func (v VirtualMachineInstancePropertiesStorageProfileDataDisksItem) 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, "id", v.ID) 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 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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) - delete(rawMsg, key) - case "clusterVersion": - err = unpopulate(val, "ClusterVersion", &c.ClusterVersion) - delete(rawMsg, key) - case "diagnosticLevel": - err = unpopulate(val, "DiagnosticLevel", &c.DiagnosticLevel) - delete(rawMsg, key) - case "imdsAttestation": - err = unpopulate(val, "ImdsAttestation", &c.ImdsAttestation) - delete(rawMsg, key) - case "lastUpdated": - err = unpopulateTimeRFC3339(val, "LastUpdated", &c.LastUpdated) - delete(rawMsg, key) - case "nodes": - err = unpopulate(val, "Nodes", &c.Nodes) + case "id": + err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstancePropertiesStorageProfileImageReference. +func (v VirtualMachineInstancePropertiesStorageProfileImageReference) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) + populate(objectMap, "id", v.ID) 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 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", e, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "id": + err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstancePropertiesStorageProfileOsDisk. +func (v VirtualMachineInstancePropertiesStorageProfileOsDisk) 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, "id", v.ID) + populate(objectMap, "osType", v.OSType) 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 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", e, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "id": + err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) + case "osType": + err = unpopulate(val, "OSType", &v.OSType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstanceStatus. +func (v VirtualMachineInstanceStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + 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 ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// 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", e, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + 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", e, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstanceStatusProvisioningStatus. +func (v VirtualMachineInstanceStatusProvisioningStatus) 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, "operationId", v.OperationID) + populate(objectMap, "status", v.Status) 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 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", e, err) + 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", &e.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) + case "operationId": + err = unpopulate(val, "OperationID", &v.OperationID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "status": + err = unpopulate(val, "Status", &v.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstanceUpdateProperties. +func (v VirtualMachineInstanceUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) + 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 ExtensionList. -func (e *ExtensionList) UnmarshalJSON(data []byte) error { +// 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", e, err) + 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", &e.NextLink) + case "hardwareProfile": + err = unpopulate(val, "HardwareProfile", &v.HardwareProfile) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) + 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", e, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstanceUpdateRequest. +func (v VirtualMachineInstanceUpdateRequest) 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", v.Identity) + populate(objectMap, "properties", v.Properties) 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 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", e, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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) - delete(rawMsg, key) - case "settings": - err = unpopulate(val, "Settings", &e.Settings) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) delete(rawMsg, key) - case "typeHandlerVersion": - err = unpopulate(val, "TypeHandlerVersion", &e.TypeHandlerVersion) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineInstanceView. +func (v VirtualMachineInstanceView) 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, "vmAgent", v.VMAgent) 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 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", e, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + case "vmAgent": + err = unpopulate(val, "VMAgent", &v.VMAgent) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualMachineVMConfigAgentInstanceView. +func (v VirtualMachineVMConfigAgentInstanceView) 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, "statuses", v.Statuses) + populate(objectMap, "vmVMConfigAgentVersion", v.VMConfigAgentVersion) 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 VirtualMachineVMConfigAgentInstanceView. +func (v *VirtualMachineVMConfigAgentInstanceView) UnmarshalJSON(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", v, 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) + case "statuses": + err = unpopulate(val, "Statuses", &v.Statuses) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) + case "vmVMConfigAgentVersion": + err = unpopulate(val, "VMConfigAgentVersion", &v.VMConfigAgentVersion) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualNetworkProperties. +func (v VirtualNetworkProperties) 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, "dhcpOptions", v.DhcpOptions) + populate(objectMap, "networkType", v.NetworkType) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "status", v.Status) + populate(objectMap, "subnets", v.Subnets) + populate(objectMap, "vmSwitchName", v.VMSwitchName) 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 VirtualNetworkProperties. +func (v *VirtualNetworkProperties) UnmarshalJSON(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", v, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) + case "dhcpOptions": + err = unpopulate(val, "DhcpOptions", &v.DhcpOptions) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) + case "networkType": + err = unpopulate(val, "NetworkType", &v.NetworkType) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) + delete(rawMsg, key) + case "subnets": + err = unpopulate(val, "Subnets", &v.Subnets) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "vmSwitchName": + err = unpopulate(val, "VMSwitchName", &v.VMSwitchName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualNetworkPropertiesDhcpOptions. +func (v VirtualNetworkPropertiesDhcpOptions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "dnsServers", v.DNSServers) 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 VirtualNetworkPropertiesDhcpOptions. +func (v *VirtualNetworkPropertiesDhcpOptions) UnmarshalJSON(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", v, 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) + case "dnsServers": + err = unpopulate(val, "DNSServers", &v.DNSServers) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualNetworkPropertiesSubnetsItem. +func (v VirtualNetworkPropertiesSubnetsItem) 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, "name", v.Name) + populate(objectMap, "properties", v.Properties) 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 VirtualNetworkPropertiesSubnetsItem. +func (v *VirtualNetworkPropertiesSubnetsItem) UnmarshalJSON(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", v, err) } for key, val := range rawMsg { var err error switch key { - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &p.EndDateTime) - delete(rawMsg, key) - case "keyId": - err = unpopulate(val, "KeyID", &p.KeyID) - delete(rawMsg, key) - case "secretText": - err = unpopulate(val, "SecretText", &p.SecretText) + case "name": + err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &p.StartDateTime) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualNetworkPropertiesSubnetsItemAutoGenerated. +func (v VirtualNetworkPropertiesSubnetsItemAutoGenerated) 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, "addressPrefix", v.AddressPrefix) + populate(objectMap, "addressPrefixes", v.AddressPrefixes) + populate(objectMap, "ipAllocationMethod", v.IPAllocationMethod) + populate(objectMap, "ipConfigurationReferences", v.IPConfigurationReferences) + populate(objectMap, "routeTable", v.RouteTable) + populate(objectMap, "vlan", v.Vlan) 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 VirtualNetworkPropertiesSubnetsItemAutoGenerated. +func (v *VirtualNetworkPropertiesSubnetsItemAutoGenerated) UnmarshalJSON(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", v, err) } for key, val := range rawMsg { var err error switch key { - case "extension": - err = unpopulate(val, "Extension", &p.Extension) + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &v.AddressPrefix) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &v.AddressPrefixes) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) + case "ipAllocationMethod": + err = unpopulate(val, "IPAllocationMethod", &v.IPAllocationMethod) + delete(rawMsg, key) + case "ipConfigurationReferences": + err = unpopulate(val, "IPConfigurationReferences", &v.IPConfigurationReferences) + delete(rawMsg, key) + case "routeTable": + err = unpopulate(val, "RouteTable", &v.RouteTable) + delete(rawMsg, key) + case "vlan": + err = unpopulate(val, "Vlan", &v.Vlan) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualNetworkPropertiesSubnetsItemRouteTableRoutesItem. +func (v VirtualNetworkPropertiesSubnetsItemRouteTableRoutesItem) 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, "addressPrefix", v.AddressPrefix) + populate(objectMap, "nextHopIpAddress", v.NextHopIPAddress) 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 VirtualNetworkPropertiesSubnetsItemRouteTableRoutesItem. +func (v *VirtualNetworkPropertiesSubnetsItemRouteTableRoutesItem) UnmarshalJSON(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", v, err) } for key, val := range rawMsg { var err error switch key { - case "arcInstance": - err = unpopulate(val, "ArcInstance", &p.ArcInstance) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &v.AddressPrefix) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) + case "nextHopIpAddress": + err = unpopulate(val, "NextHopIPAddress", &v.NextHopIPAddress) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualNetworkPropertiesSubnetsPropertiesItemsItem. +func (v VirtualNetworkPropertiesSubnetsPropertiesItemsItem) 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, "name", v.Name) + populate(objectMap, "properties", v.Properties) 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 VirtualNetworkPropertiesSubnetsPropertiesItemsItem. +func (v *VirtualNetworkPropertiesSubnetsPropertiesItemsItem) UnmarshalJSON(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", v, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) + err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualNetworkStatus. +func (v VirtualNetworkStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "certificates", r.Certificates) + 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 RawCertificateData. -func (r *RawCertificateData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkStatus. +func (v *VirtualNetworkStatus) UnmarshalJSON(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", v, err) } for key, val := range rawMsg { var err error switch key { - case "certificates": - err = unpopulate(val, "Certificates", &r.Certificates) + 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", r, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualNetworkStatusProvisioningStatus. +func (v VirtualNetworkStatusProvisioningStatus) 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, "operationId", v.OperationID) + populate(objectMap, "status", v.Status) 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 VirtualNetworkStatusProvisioningStatus. +func (v *VirtualNetworkStatusProvisioningStatus) UnmarshalJSON(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", v, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) + case "operationId": + err = unpopulate(val, "OperationID", &v.OperationID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "status": + err = unpopulate(val, "Status", &v.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualNetworks. +func (v VirtualNetworks) 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, "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 SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworks. +func (v *VirtualNetworks) UnmarshalJSON(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", v, err) } for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &v.ExtendedLocation) delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) + case "id": + err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) + case "location": + err = unpopulate(val, "Location", &v.Location) delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + case "name": + err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + 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", s, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualNetworksListResult. +func (v VirtualNetworksListResult) 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, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) 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 VirtualNetworksListResult. +func (v *VirtualNetworksListResult) UnmarshalJSON(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", v, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "value": + err = unpopulate(val, "Value", &v.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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 VirtualNetworksUpdateRequest. +func (v VirtualNetworksUpdateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", u.Properties) + populate(objectMap, "tags", v.Tags) 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 VirtualNetworksUpdateRequest. +func (v *VirtualNetworksUpdateRequest) UnmarshalJSON(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", v, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &u.Properties) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) 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..169dba01c4ea --- /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-07-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-07-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-07-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-07-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-07-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.StatusOK, 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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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/operations_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go deleted file mode 100644 index a5031296580c..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go +++ /dev/null @@ -1,82 +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" - "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" -) - -// OperationsClient contains the methods for the Operations group. -// Don't use this type directly, use NewOperationsClient() instead. -type OperationsClient struct { - internal *arm.Client -} - -// NewOperationsClient creates a new instance of OperationsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &OperationsClient{ - internal: cl, - } - return client, nil -} - -// List - List all available Microsoft.AzureStackHCI provider operations -// If the operation fails it returns an *azcore.ResponseError type. -// -// 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) -} - -// listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.AzureStackHCI/operations" - 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 -} - -// listHandleResponse handles the List response. -func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client_example_test.go deleted file mode 100644 index 597dadc8d108..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client_example_test.go +++ /dev/null @@ -1,381 +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/ListOperations.json -func ExampleOperationsClient_List() { - 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.NewOperationsClient().List(ctx, 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.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..4be06865aaae --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/options.go @@ -0,0 +1,312 @@ +//go:build go1.18 +// +build 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 +} + +// 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 +} + +// 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 +} + +// VirtualNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginCreateOrUpdate +// method. +type VirtualNetworksClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworksClient.BeginDelete method. +type VirtualNetworksClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworksClientBeginUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginUpdate method. +type VirtualNetworksClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworksClientGetOptions contains the optional parameters for the VirtualNetworksClient.Get method. +type VirtualNetworksClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientListAllOptions contains the optional parameters for the VirtualNetworksClient.NewListAllPager method. +type VirtualNetworksClientListAllOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientListOptions contains the optional parameters for the VirtualNetworksClient.NewListPager method. +type VirtualNetworksClientListOptions 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..a24d5aba2e76 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go @@ -3,113 +3,288 @@ // 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 +} + +// GalleryImagesClientGetResponse contains the response from method GalleryImagesClient.Get. +type GalleryImagesClientGetResponse struct { + // The gallery images resource definition. + GalleryImages +} + +// GalleryImagesClientListAllResponse contains the response from method GalleryImagesClient.NewListAllPager. +type GalleryImagesClientListAllResponse struct { + // List of gallery images. + GalleryImagesListResult +} + +// 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 +} + +// GuestAgentClientGetResponse contains the response from method GuestAgentClient.Get. +type GuestAgentClientGetResponse struct { + // Defines the GuestAgent. + GuestAgent +} + +// GuestAgentsClientListResponse contains the response from method GuestAgentsClient.NewListPager. +type GuestAgentsClientListResponse struct { + // List of GuestAgent. + GuestAgentList +} + +// HybridIdentityMetadataClientGetResponse contains the response from method HybridIdentityMetadataClient.Get. +type HybridIdentityMetadataClientGetResponse struct { + // Defines the HybridIdentityMetadata. + HybridIdentityMetadata +} + +// HybridIdentityMetadataClientListResponse contains the response from method HybridIdentityMetadataClient.NewListPager. +type HybridIdentityMetadataClientListResponse struct { + // List of HybridIdentityMetadata. + HybridIdentityMetadataList +} + +// MarketplaceGalleryImagesClientCreateOrUpdateResponse contains the response from method MarketplaceGalleryImagesClient.BeginCreateOrUpdate. +type MarketplaceGalleryImagesClientCreateOrUpdateResponse struct { + // The marketplace gallery image resource definition. + MarketplaceGalleryImages +} + +// MarketplaceGalleryImagesClientDeleteResponse contains the response from method MarketplaceGalleryImagesClient.BeginDelete. +type MarketplaceGalleryImagesClientDeleteResponse struct { + // placeholder for future response values +} + +// 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 } -// ArcSettingsClientDeleteResponse contains the response from method ArcSettingsClient.BeginDelete. -type ArcSettingsClientDeleteResponse struct { +// MarketplaceGalleryImagesClientListResponse contains the response from method MarketplaceGalleryImagesClient.NewListPager. +type MarketplaceGalleryImagesClientListResponse struct { + MarketplaceGalleryImagesListResult +} + +// 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 } -// ArcSettingsClientGeneratePasswordResponse contains the response from method ArcSettingsClient.GeneratePassword. -type ArcSettingsClientGeneratePasswordResponse struct { - PasswordCredential +// NetworkInterfacesClientGetResponse contains the response from method NetworkInterfacesClient.Get. +type NetworkInterfacesClientGetResponse struct { + // The network interface resource definition. + NetworkInterfaces +} + +// NetworkInterfacesClientListAllResponse contains the response from method NetworkInterfacesClient.NewListAllPager. +type NetworkInterfacesClientListAllResponse struct { + NetworkInterfacesListResult } -// ArcSettingsClientGetResponse contains the response from method ArcSettingsClient.Get. -type ArcSettingsClientGetResponse struct { - ArcSetting +// NetworkInterfacesClientListResponse contains the response from method NetworkInterfacesClient.NewListPager. +type NetworkInterfacesClientListResponse struct { + NetworkInterfacesListResult } -// ArcSettingsClientListByClusterResponse contains the response from method ArcSettingsClient.NewListByClusterPager. -type ArcSettingsClientListByClusterResponse struct { - ArcSettingList +// NetworkInterfacesClientUpdateResponse contains the response from method NetworkInterfacesClient.BeginUpdate. +type NetworkInterfacesClientUpdateResponse struct { + // The network interface resource definition. + NetworkInterfaces } -// ArcSettingsClientUpdateResponse contains the response from method ArcSettingsClient.Update. -type ArcSettingsClientUpdateResponse struct { - ArcSetting +// StorageContainersClientCreateOrUpdateResponse contains the response from method StorageContainersClient.BeginCreateOrUpdate. +type StorageContainersClientCreateOrUpdateResponse struct { + // The storage container resource definition. + StorageContainers } -// ClustersClientCreateIdentityResponse contains the response from method ClustersClient.BeginCreateIdentity. -type ClustersClientCreateIdentityResponse struct { - ClusterIdentityResponse +// 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 } -// ClustersClientCreateResponse contains the response from method ClustersClient.Create. -type ClustersClientCreateResponse struct { - Cluster +// StorageContainersClientUpdateResponse contains the response from method StorageContainersClient.BeginUpdate. +type StorageContainersClientUpdateResponse struct { + // The storage container resource definition. + StorageContainers } -// ClustersClientDeleteResponse contains the response from method ClustersClient.BeginDelete. -type ClustersClientDeleteResponse struct { +// 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 } -// ClustersClientGetResponse contains the response from method ClustersClient.Get. -type ClustersClientGetResponse struct { - Cluster +// 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 } -// ClustersClientListByResourceGroupResponse contains the response from method ClustersClient.NewListByResourceGroupPager. -type ClustersClientListByResourceGroupResponse struct { - ClusterList +// VirtualHardDisksClientListResponse contains the response from method VirtualHardDisksClient.NewListPager. +type VirtualHardDisksClientListResponse struct { + VirtualHardDisksListResult } -// ClustersClientListBySubscriptionResponse contains the response from method ClustersClient.NewListBySubscriptionPager. -type ClustersClientListBySubscriptionResponse struct { - ClusterList +// VirtualHardDisksClientUpdateResponse contains the response from method VirtualHardDisksClient.BeginUpdate. +type VirtualHardDisksClientUpdateResponse struct { + // The virtual hard disk resource definition. + VirtualHardDisks } -// ClustersClientUpdateResponse contains the response from method ClustersClient.Update. -type ClustersClientUpdateResponse struct { - Cluster +// VirtualMachineInstancesClientCreateOrUpdateResponse contains the response from method VirtualMachineInstancesClient.BeginCreateOrUpdate. +type VirtualMachineInstancesClientCreateOrUpdateResponse struct { + // The virtual machine instance resource definition. + VirtualMachineInstance } -// ClustersClientUploadCertificateResponse contains the response from method ClustersClient.BeginUploadCertificate. -type ClustersClientUploadCertificateResponse struct { +// VirtualMachineInstancesClientDeleteResponse contains the response from method VirtualMachineInstancesClient.BeginDelete. +type VirtualMachineInstancesClientDeleteResponse struct { // placeholder for future response values } -// ExtensionsClientCreateResponse contains the response from method ExtensionsClient.BeginCreate. -type ExtensionsClientCreateResponse struct { - Extension +// 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 +} + +// VirtualNetworksClientCreateOrUpdateResponse contains the response from method VirtualNetworksClient.BeginCreateOrUpdate. +type VirtualNetworksClientCreateOrUpdateResponse struct { + // The virtual network resource definition. + VirtualNetworks } -// ExtensionsClientDeleteResponse contains the response from method ExtensionsClient.BeginDelete. -type ExtensionsClientDeleteResponse struct { +// VirtualNetworksClientDeleteResponse contains the response from method VirtualNetworksClient.BeginDelete. +type VirtualNetworksClientDeleteResponse struct { // placeholder for future response values } -// ExtensionsClientGetResponse contains the response from method ExtensionsClient.Get. -type ExtensionsClientGetResponse struct { - Extension +// VirtualNetworksClientGetResponse contains the response from method VirtualNetworksClient.Get. +type VirtualNetworksClientGetResponse struct { + // The virtual network resource definition. + VirtualNetworks } -// ExtensionsClientListByArcSettingResponse contains the response from method ExtensionsClient.NewListByArcSettingPager. -type ExtensionsClientListByArcSettingResponse struct { - ExtensionList +// VirtualNetworksClientListAllResponse contains the response from method VirtualNetworksClient.NewListAllPager. +type VirtualNetworksClientListAllResponse struct { + VirtualNetworksListResult } -// ExtensionsClientUpdateResponse contains the response from method ExtensionsClient.BeginUpdate. -type ExtensionsClientUpdateResponse struct { - Extension +// VirtualNetworksClientListResponse contains the response from method VirtualNetworksClient.NewListPager. +type VirtualNetworksClientListResponse struct { + VirtualNetworksListResult } -// OperationsClientListResponse contains the response from method OperationsClient.List. -type OperationsClientListResponse struct { - OperationListResult +// VirtualNetworksClientUpdateResponse contains the response from method VirtualNetworksClient.BeginUpdate. +type VirtualNetworksClientUpdateResponse struct { + // The virtual network resource definition. + VirtualNetworks } diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client.go new file mode 100644 index 000000000000..5144dbab2a45 --- /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-07-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-07-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-07-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-07-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-07-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.StatusOK, 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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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/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..89c223be78e0 --- /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-07-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-07-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-07-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-07-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-07-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.StatusOK, 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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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/virtualmachineinstances_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client.go new file mode 100644 index 000000000000..3daaa218cd24 --- /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-07-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-07-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-07-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-07-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-07-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.StatusOK, 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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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-07-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/virtualnetworks_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualnetworks_client.go new file mode 100644 index 000000000000..7ecbab0a9a1a --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualnetworks_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" +) + +// VirtualNetworksClient contains the methods for the VirtualNetworks group. +// Don't use this type directly, use NewVirtualNetworksClient() instead. +type VirtualNetworksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVirtualNetworksClient creates a new instance of VirtualNetworksClient 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 NewVirtualNetworksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworksClient, error) { + cl, err := arm.NewClient(moduleName+".VirtualNetworksClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualNetworksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a virtual network. Please note some properties can be set only +// during virtual network creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - virtualNetworkName - Name of the virtual network +// - options - VirtualNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginCreateOrUpdate +// method. +func (client *VirtualNetworksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetworks, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworksClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualNetworkName, virtualNetworks, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworksClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - The operation to create or update a virtual network. Please note some properties can be set only during +// virtual network creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *VirtualNetworksClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetworks, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkName, virtualNetworks, 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 *VirtualNetworksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetworks, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualNetworks/{virtualNetworkName}" + 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 virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + 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-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, virtualNetworks); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete a virtual network. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - virtualNetworkName - Name of the virtual network +// - options - VirtualNetworksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworksClient.BeginDelete +// method. +func (client *VirtualNetworksClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*runtime.Poller[VirtualNetworksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworksClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - The operation to delete a virtual network. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *VirtualNetworksClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualNetworksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualNetworks/{virtualNetworkName}" + 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 virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + 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-07-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-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - virtualNetworkName - Name of the virtual network +// - options - VirtualNetworksClientGetOptions contains the optional parameters for the VirtualNetworksClient.Get method. +func (client *VirtualNetworksClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientGetOptions) (VirtualNetworksClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return VirtualNetworksClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworksClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworksClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VirtualNetworksClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualNetworks/{virtualNetworkName}" + 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 virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + 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-07-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 *VirtualNetworksClient) getHandleResponse(resp *http.Response) (VirtualNetworksClientGetResponse, error) { + result := VirtualNetworksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworks); err != nil { + return VirtualNetworksClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all of the virtual networks in the specified resource group. Use the nextLink property in the response +// to get the next page of virtual networks. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - VirtualNetworksClientListOptions contains the optional parameters for the VirtualNetworksClient.NewListPager +// method. +func (client *VirtualNetworksClient) NewListPager(resourceGroupName string, options *VirtualNetworksClientListOptions) *runtime.Pager[VirtualNetworksClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworksClientListResponse]{ + More: func(page VirtualNetworksClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworksClientListResponse) (VirtualNetworksClientListResponse, 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 VirtualNetworksClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworksClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworksClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualNetworksClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualNetworksClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualNetworks" + 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-07-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 *VirtualNetworksClient) listHandleResponse(resp *http.Response) (VirtualNetworksClientListResponse, error) { + result := VirtualNetworksClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworksListResult); err != nil { + return VirtualNetworksClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Lists all of the virtual networks in the specified subscription. Use the nextLink property in the response +// to get the next page of virtual networks. +// +// Generated from API version 2023-07-01-preview +// - options - VirtualNetworksClientListAllOptions contains the optional parameters for the VirtualNetworksClient.NewListAllPager +// method. +func (client *VirtualNetworksClient) NewListAllPager(options *VirtualNetworksClientListAllOptions) *runtime.Pager[VirtualNetworksClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworksClientListAllResponse]{ + More: func(page VirtualNetworksClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworksClientListAllResponse) (VirtualNetworksClientListAllResponse, 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 VirtualNetworksClientListAllResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworksClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworksClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *VirtualNetworksClient) listAllCreateRequest(ctx context.Context, options *VirtualNetworksClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualNetworks" + 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-07-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 *VirtualNetworksClient) listAllHandleResponse(resp *http.Response) (VirtualNetworksClientListAllResponse, error) { + result := VirtualNetworksClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworksListResult); err != nil { + return VirtualNetworksClientListAllResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update a virtual network. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - virtualNetworkName - Name of the virtual network +// - options - VirtualNetworksClientBeginUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginUpdate +// method. +func (client *VirtualNetworksClient) BeginUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetworksUpdateRequest, options *VirtualNetworksClientBeginUpdateOptions) (*runtime.Poller[VirtualNetworksClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, virtualNetworkName, virtualNetworks, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworksClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - The operation to update a virtual network. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *VirtualNetworksClient) update(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetworksUpdateRequest, options *VirtualNetworksClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, virtualNetworkName, virtualNetworks, 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 *VirtualNetworksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetworksUpdateRequest, options *VirtualNetworksClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualNetworks/{virtualNetworkName}" + 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 virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + 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-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, virtualNetworks); err != nil { + return nil, err + } + return req, nil +}